java - Spring security- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains' -


hi trying implement spring security in project following tutorial http://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/#config, getting following exception while running program-

org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.security.filterchains': initialization of bean failed; nested exception java.lang.nosuchfielderror: null @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:532)

my web.xml looks like-

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"     xsi:schemalocation="       http://java.sun.com/xml/ns/javaee       http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="webapp_id" version="3.0">      <display-name>spring mvc application</display-name>      <!-- spring root -->     <context-param>         <param-name>contextclass</param-name>         <param-value>          org.springframework.web.context.support.annotationconfigwebapplicationcontext       </param-value>     </context-param>     <context-param>         <param-name>contextconfiglocation</param-name>         <param-value>org.baeldung.spring</param-value>     </context-param>      <listener>         <listener-class>org.springframework.web.context.contextloaderlistener</listener-class>     </listener>      <!-- spring child -->     <servlet>         <servlet-name>api</servlet-name>         <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>api</servlet-name>         <url-pattern>/api/*</url-pattern>     </servlet-mapping>      <!-- spring security -->     <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>      <!-- <welcome-file-list> -->     <!-- <welcome-file>index.html</welcome-file> -->     <!-- </welcome-file-list> -->  </web-app> 

and websecurityconfig.xml looks like-

http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">

<http use-expressions="true" entry-point-ref="restauthenticationentrypoint">     <intercept-url pattern="/api/**" access="isauthenticated()" />      <sec:form-login authentication-success-handler-ref="mysuccesshandler" />      <logout /> </http>  <beans:bean id="mysuccesshandler" class="org.baeldung.security.mysavedrequestawareauthenticationsuccesshandler" />  <authentication-manager alias="authenticationmanager">     <authentication-provider>         <user-service>             <user name="temporary" password="temporary" authorities="role_admin" />             <user name="user" password="userpass" authorities="role_user" />         </user-service>     </authentication-provider> </authentication-manager> 

i know possible duplicate of org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.security.filterchains', have tried solution no avail might because still novice in springs. highly appreciated.

i loading websecurityconfig.xml secsecurityconfig.java in org.baeldung.spring framework looks like-

package org.baeldung.spring;  import org.springframework.context.annotation.componentscan; import org.springframework.context.annotation.configuration; import org.springframework.context.annotation.importresource;  @configuration @importresource({ "classpath:websecurityconfig.xml" }) @componentscan("org.baeldung.security") public class secsecurityconfig {      public secsecurityconfig() {         super();     }  } 

looking @ stacktrace information appears if have conflicting framework jars in classpath. when using maven use mvn dependency:tree figure out dependencies used, suspect there older spring-beans.jar in classpath.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -