2013-12-04 2 views
0

Я новичок в весной и я пытаюсь интегрировать OpenId в моем приложенииПопытка интегрировать OpenId весной, но дает BeanDefinitionParsingException

я получаю это исключение и, следовательно, ошибка 404.

консоли журнала:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map> 

Мой web.xml: -

<servlet> 
    <servlet-name>dispatcher</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

<servlet-mapping> 
    <servlet-name>dispatcher</servlet-name> 
    <url-pattern>/rest/*</url-pattern> 
</servlet-mapping> 

<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value> 
     /WEB-INF/spring/applicationContext-security.xml 
    </param-value> 
</context-param> 

<welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
</welcome-file-list> 

часть, если мой диспетчеру-servlet.xml: -

<?xml version="1.0" encoding="UTF-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:tx="http://www.springframework.org/schema/tx" 
xmlns:oxm="http://www.springframework.org/schema/oxm" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.0.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
    http://www.springframework.org/schema/oxm 
    http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd"> 

<context:property-placeholder location="classpath:jdbc.properties" /> 
<context:component-scan base-package="com.kratin" /> 

<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> 
    <property name="order" value="1" /> 
    <property name="messageConverters"> 
     <list> 
      <!-- Default converters --> 
      <bean class="org.springframework.http.converter.StringHttpMessageConverter"/> 
      <bean class="org.springframework.http.converter.FormHttpMessageConverter"/> 
      <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /> 
      <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/> 
      <bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/> 
      <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /> 
     </list> 
    </property> 
</bean> 

индекс. jsp: -

<a href="j_spring_openid_security_check?openid_identifier=https://www.google.com/accounts/o8/id">Login via Google</a><br></br> 
Войти через любой Open ID поставщика

ApplicationContext-security.xml

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/security" 
xmlns:beans="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:sec="http://www.springframework.org/schema/security" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 

http://www.springframework.org/schema/security 

http://www.springframework.org/schema/security/spring-security-3.0.xsd"> 

<http auto-config="true" use-expressions="true"> 
    <intercept-url pattern="/**" access="permitAll" /> 
    <openid-login> 
     <attribute-exchange> 
       <openid-attribute name="email" type="http://axschema.org/contact/email" required="true" /> 
       <openid-attribute name="fullname" type="http://axschema.org/namePerson" /> 
       <openid-attribute name="first" type="http://axschema.org/namePerson/first" /> 
       <openid-attribute name="last" type="http://axschema.org/namePerson/last" /> 
     </attribute-exchange> 
    </openid-login> 
    <logout /> 
</http> 

</beans:beans> 

Может кто-нибудь, пожалуйста, руководство меня, если я сделал какую-либо ошибку или помочь мне какое-то решение! Есть ли другие требования к openId весной

ответ

0

Вам необходимо убедиться, что у вас есть Spring-security-web и aps сервлета на вашем пути к классам. Например, если вы используете Maven вы бы обеспечить следующее было в вашем pom.xml:

<dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-config</artifactId> 
    <version>3.1.3.RELEASE</version> 
    <scope>compile</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework.security</groupId> 
    <artifactId>spring-security-web</artifactId> 
    <version>3.1.3.RELEASE</version> 
    <scope>compile</scope> 
</dependency> 
<dependency> 
    <groupId>javax.servlet.jsp</groupId> 
    <artifactId>jsp-api</artifactId> 
    <version>2.1</version> 
    <scope>provided</scope> 
</dependency> 
+0

org.springframework.beans.factory.BeanCreationException: Ошибка при создании боб с именем «org.springframework.security.authentication. ProviderManager # 0 ': не может создать внутренний bean-элемент (внутренний компонент) типа [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] при настройке bean-свойства «parent»; org.springframework.beans.factory.NoSuchBeanDefinitionException: не определен bean с именем «org.springframework.security.authenticationManager»: вы забыли добавить в свою конфигурацию элемент (с дочерними элементами ) ? – user3056194

+0

Весенне-охранной интернет-банки не хватало. Я добавил его, но теперь я получаю исключение выше. Мне просто нужно реализовать openId весной, что позволит пользователю войти в систему с помощью учетной записи google и извлечь e-mail_id, а также сохранить имя и сохранить в базе данных. – user3056194

+0

Если я правильно ответил на ваш вопрос, вы должны отметить его как принятый и создать новый вопрос. В противном случае другим будет сложно найти ответы здесь. –

Смежные вопросы