BeanDefinitionStoreException in security xml (spring and security jars versions compatibility)











up vote
-2
down vote

favorite












The following error shows after adding the security xml configurations and jar files to my project



org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V




web.xml




<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">

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

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

<display-name>spring-mvc-demo</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>

<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>
</web-app>



spring-security.xml




<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">

<http>
<intercept-url pattern="/**" access="hasRole('USER')" />
<form-login />
<logout />
</http>


<authentication-manager>
<authentication-provider>
<user-service>
<user name="bob" password="bobspassword" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>



some libs




aopalliance-1.0.jar



aspectjrt-1.6.8.jar



aspectjweaver-1.6.8.jar



classmate-1.3.4.jar



commons-beanutils-1.8.0.jar



commons-collections-3.2.jar



commons-digester-2.0.jar



commons-lang-2.4.jar



commons-logging-1.1.1.jar



jstl-1.2.jar



mysql-connector-java-8.0.12.jar



org.springframework.asm-3.0.1.RELEASE-A.jar



org.springframework.beans-3.0.1.RELEASE-A.jar



org.springframework.context-3.0.1.RELEASE-A.jar



org.springframework.core-3.0.1.RELEASE-A.jar



org.springframework.expression-3.0.1.RELEASE-A.jar



org.springframework.oxm-3.0.1.RELEASE-A.jar



org.springframework.web-3.0.1.RELEASE-A.jar



org.springframework.web.portlet-3.0.1.RELEASE-A.jar



org.springframework.web.servlet-3.0.1.RELEASE-A.jar



org.springframework.web.struts-3.0.1.RELEASE-A.jar



oro-2.0.8.jar



servlet-api.jar



spring-aop-3.0.1.RELEASE.jar



spring-aop-5.0.9.RELEASE-javadoc.jar



spring-aop-5.0.9.RELEASE-sources.jar



spring-aop-5.0.9.RELEASE.jar



spring-aspects-5.0.9.RELEASE-javadoc.jar



spring-aspects-5.0.9.RELEASE-sources.jar



spring-aspects-5.0.9.RELEASE.jar



spring-beans-2.5.6.jar



spring-beans-5.0.9.RELEASE-javadoc.jar



spring-beans-5.0.9.RELEASE-sources.jar



spring-beans-5.0.9.RELEASE.jar



spring-context-2.5.6.jar



spring-context-5.0.9.RELEASE-javadoc.jar



spring-context-5.0.9.RELEASE-sources.jar



spring-context-5.0.9.RELEASE.jar



spring-context-indexer-5.0.9.RELEASE-javadoc.jar



spring-context-indexer-5.0.9.RELEASE-sources.jar



spring-context-indexer-5.0.9.RELEASE.jar



spring-context-support-5.0.9.RELEASE-javadoc.jar



spring-context-support-5.0.9.RELEASE-sources.jar



spring-context-support-5.0.9.RELEASE.jar



spring-core-2.5.6.jar



spring-core-5.0.9.RELEASE-javadoc.jar



spring-core-5.0.9.RELEASE-sources.jar



spring-core-5.0.9.RELEASE.jar



spring-expression-5.0.9.RELEASE-javadoc.jar



spring-expression-5.0.9.RELEASE-sources.jar



spring-expression-5.0.9.RELEASE.jar



spring-instrument-5.0.9.RELEASE-javadoc.jar



spring-instrument-5.0.9.RELEASE-sources.jar



spring-instrument-5.0.9.RELEASE.jar



spring-security-config-3.0.2.RELEASE.jar



spring-security-core-3.0.2.RELEASE.jar



spring-security-web-3.0.2.RELEASE.jar



spring-tx-3.0.1.RELEASE.jar



spring-tx-5.0.9.RELEASE-javadoc.jar



spring-tx-5.0.9.RELEASE-sources.jar



spring-tx-5.0.9.RELEASE.jar



spring-web-2.5.6.jar



spring-web-5.0.9.RELEASE-javadoc.jar



spring-web-5.0.9.RELEASE-sources.jar



spring-web-5.0.9.RELEASE.jar




I trie the same code but this time in maven project still giving the same error and this is the pom.xml




<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>



<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
</dependencies>









share|improve this question
























  • I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
    – moilejter
    Nov 10 at 21:01










  • i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
    – Tasnim Marwan
    Nov 10 at 21:06












  • But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
    – moilejter
    Nov 10 at 21:25















up vote
-2
down vote

favorite












The following error shows after adding the security xml configurations and jar files to my project



org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V




web.xml




<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">

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

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

<display-name>spring-mvc-demo</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>

<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>
</web-app>



spring-security.xml




<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">

<http>
<intercept-url pattern="/**" access="hasRole('USER')" />
<form-login />
<logout />
</http>


<authentication-manager>
<authentication-provider>
<user-service>
<user name="bob" password="bobspassword" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>



some libs




aopalliance-1.0.jar



aspectjrt-1.6.8.jar



aspectjweaver-1.6.8.jar



classmate-1.3.4.jar



commons-beanutils-1.8.0.jar



commons-collections-3.2.jar



commons-digester-2.0.jar



commons-lang-2.4.jar



commons-logging-1.1.1.jar



jstl-1.2.jar



mysql-connector-java-8.0.12.jar



org.springframework.asm-3.0.1.RELEASE-A.jar



org.springframework.beans-3.0.1.RELEASE-A.jar



org.springframework.context-3.0.1.RELEASE-A.jar



org.springframework.core-3.0.1.RELEASE-A.jar



org.springframework.expression-3.0.1.RELEASE-A.jar



org.springframework.oxm-3.0.1.RELEASE-A.jar



org.springframework.web-3.0.1.RELEASE-A.jar



org.springframework.web.portlet-3.0.1.RELEASE-A.jar



org.springframework.web.servlet-3.0.1.RELEASE-A.jar



org.springframework.web.struts-3.0.1.RELEASE-A.jar



oro-2.0.8.jar



servlet-api.jar



spring-aop-3.0.1.RELEASE.jar



spring-aop-5.0.9.RELEASE-javadoc.jar



spring-aop-5.0.9.RELEASE-sources.jar



spring-aop-5.0.9.RELEASE.jar



spring-aspects-5.0.9.RELEASE-javadoc.jar



spring-aspects-5.0.9.RELEASE-sources.jar



spring-aspects-5.0.9.RELEASE.jar



spring-beans-2.5.6.jar



spring-beans-5.0.9.RELEASE-javadoc.jar



spring-beans-5.0.9.RELEASE-sources.jar



spring-beans-5.0.9.RELEASE.jar



spring-context-2.5.6.jar



spring-context-5.0.9.RELEASE-javadoc.jar



spring-context-5.0.9.RELEASE-sources.jar



spring-context-5.0.9.RELEASE.jar



spring-context-indexer-5.0.9.RELEASE-javadoc.jar



spring-context-indexer-5.0.9.RELEASE-sources.jar



spring-context-indexer-5.0.9.RELEASE.jar



spring-context-support-5.0.9.RELEASE-javadoc.jar



spring-context-support-5.0.9.RELEASE-sources.jar



spring-context-support-5.0.9.RELEASE.jar



spring-core-2.5.6.jar



spring-core-5.0.9.RELEASE-javadoc.jar



spring-core-5.0.9.RELEASE-sources.jar



spring-core-5.0.9.RELEASE.jar



spring-expression-5.0.9.RELEASE-javadoc.jar



spring-expression-5.0.9.RELEASE-sources.jar



spring-expression-5.0.9.RELEASE.jar



spring-instrument-5.0.9.RELEASE-javadoc.jar



spring-instrument-5.0.9.RELEASE-sources.jar



spring-instrument-5.0.9.RELEASE.jar



spring-security-config-3.0.2.RELEASE.jar



spring-security-core-3.0.2.RELEASE.jar



spring-security-web-3.0.2.RELEASE.jar



spring-tx-3.0.1.RELEASE.jar



spring-tx-5.0.9.RELEASE-javadoc.jar



spring-tx-5.0.9.RELEASE-sources.jar



spring-tx-5.0.9.RELEASE.jar



spring-web-2.5.6.jar



spring-web-5.0.9.RELEASE-javadoc.jar



spring-web-5.0.9.RELEASE-sources.jar



spring-web-5.0.9.RELEASE.jar




I trie the same code but this time in maven project still giving the same error and this is the pom.xml




<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>



<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
</dependencies>









share|improve this question
























  • I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
    – moilejter
    Nov 10 at 21:01










  • i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
    – Tasnim Marwan
    Nov 10 at 21:06












  • But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
    – moilejter
    Nov 10 at 21:25













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











The following error shows after adding the security xml configurations and jar files to my project



org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V




web.xml




<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">

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

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

<display-name>spring-mvc-demo</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>

<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>
</web-app>



spring-security.xml




<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">

<http>
<intercept-url pattern="/**" access="hasRole('USER')" />
<form-login />
<logout />
</http>


<authentication-manager>
<authentication-provider>
<user-service>
<user name="bob" password="bobspassword" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>



some libs




aopalliance-1.0.jar



aspectjrt-1.6.8.jar



aspectjweaver-1.6.8.jar



classmate-1.3.4.jar



commons-beanutils-1.8.0.jar



commons-collections-3.2.jar



commons-digester-2.0.jar



commons-lang-2.4.jar



commons-logging-1.1.1.jar



jstl-1.2.jar



mysql-connector-java-8.0.12.jar



org.springframework.asm-3.0.1.RELEASE-A.jar



org.springframework.beans-3.0.1.RELEASE-A.jar



org.springframework.context-3.0.1.RELEASE-A.jar



org.springframework.core-3.0.1.RELEASE-A.jar



org.springframework.expression-3.0.1.RELEASE-A.jar



org.springframework.oxm-3.0.1.RELEASE-A.jar



org.springframework.web-3.0.1.RELEASE-A.jar



org.springframework.web.portlet-3.0.1.RELEASE-A.jar



org.springframework.web.servlet-3.0.1.RELEASE-A.jar



org.springframework.web.struts-3.0.1.RELEASE-A.jar



oro-2.0.8.jar



servlet-api.jar



spring-aop-3.0.1.RELEASE.jar



spring-aop-5.0.9.RELEASE-javadoc.jar



spring-aop-5.0.9.RELEASE-sources.jar



spring-aop-5.0.9.RELEASE.jar



spring-aspects-5.0.9.RELEASE-javadoc.jar



spring-aspects-5.0.9.RELEASE-sources.jar



spring-aspects-5.0.9.RELEASE.jar



spring-beans-2.5.6.jar



spring-beans-5.0.9.RELEASE-javadoc.jar



spring-beans-5.0.9.RELEASE-sources.jar



spring-beans-5.0.9.RELEASE.jar



spring-context-2.5.6.jar



spring-context-5.0.9.RELEASE-javadoc.jar



spring-context-5.0.9.RELEASE-sources.jar



spring-context-5.0.9.RELEASE.jar



spring-context-indexer-5.0.9.RELEASE-javadoc.jar



spring-context-indexer-5.0.9.RELEASE-sources.jar



spring-context-indexer-5.0.9.RELEASE.jar



spring-context-support-5.0.9.RELEASE-javadoc.jar



spring-context-support-5.0.9.RELEASE-sources.jar



spring-context-support-5.0.9.RELEASE.jar



spring-core-2.5.6.jar



spring-core-5.0.9.RELEASE-javadoc.jar



spring-core-5.0.9.RELEASE-sources.jar



spring-core-5.0.9.RELEASE.jar



spring-expression-5.0.9.RELEASE-javadoc.jar



spring-expression-5.0.9.RELEASE-sources.jar



spring-expression-5.0.9.RELEASE.jar



spring-instrument-5.0.9.RELEASE-javadoc.jar



spring-instrument-5.0.9.RELEASE-sources.jar



spring-instrument-5.0.9.RELEASE.jar



spring-security-config-3.0.2.RELEASE.jar



spring-security-core-3.0.2.RELEASE.jar



spring-security-web-3.0.2.RELEASE.jar



spring-tx-3.0.1.RELEASE.jar



spring-tx-5.0.9.RELEASE-javadoc.jar



spring-tx-5.0.9.RELEASE-sources.jar



spring-tx-5.0.9.RELEASE.jar



spring-web-2.5.6.jar



spring-web-5.0.9.RELEASE-javadoc.jar



spring-web-5.0.9.RELEASE-sources.jar



spring-web-5.0.9.RELEASE.jar




I trie the same code but this time in maven project still giving the same error and this is the pom.xml




<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>



<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
</dependencies>









share|improve this question















The following error shows after adding the security xml configurations and jar files to my project



org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-security.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.util.Assert.notNull(Ljava/lang/Object;Ljava/util/function/Supplier;)V




web.xml




<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID" version="3.1">

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

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

<display-name>spring-mvc-demo</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>

<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>
</web-app>



spring-security.xml




<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">

<http>
<intercept-url pattern="/**" access="hasRole('USER')" />
<form-login />
<logout />
</http>


<authentication-manager>
<authentication-provider>
<user-service>
<user name="bob" password="bobspassword" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>



some libs




aopalliance-1.0.jar



aspectjrt-1.6.8.jar



aspectjweaver-1.6.8.jar



classmate-1.3.4.jar



commons-beanutils-1.8.0.jar



commons-collections-3.2.jar



commons-digester-2.0.jar



commons-lang-2.4.jar



commons-logging-1.1.1.jar



jstl-1.2.jar



mysql-connector-java-8.0.12.jar



org.springframework.asm-3.0.1.RELEASE-A.jar



org.springframework.beans-3.0.1.RELEASE-A.jar



org.springframework.context-3.0.1.RELEASE-A.jar



org.springframework.core-3.0.1.RELEASE-A.jar



org.springframework.expression-3.0.1.RELEASE-A.jar



org.springframework.oxm-3.0.1.RELEASE-A.jar



org.springframework.web-3.0.1.RELEASE-A.jar



org.springframework.web.portlet-3.0.1.RELEASE-A.jar



org.springframework.web.servlet-3.0.1.RELEASE-A.jar



org.springframework.web.struts-3.0.1.RELEASE-A.jar



oro-2.0.8.jar



servlet-api.jar



spring-aop-3.0.1.RELEASE.jar



spring-aop-5.0.9.RELEASE-javadoc.jar



spring-aop-5.0.9.RELEASE-sources.jar



spring-aop-5.0.9.RELEASE.jar



spring-aspects-5.0.9.RELEASE-javadoc.jar



spring-aspects-5.0.9.RELEASE-sources.jar



spring-aspects-5.0.9.RELEASE.jar



spring-beans-2.5.6.jar



spring-beans-5.0.9.RELEASE-javadoc.jar



spring-beans-5.0.9.RELEASE-sources.jar



spring-beans-5.0.9.RELEASE.jar



spring-context-2.5.6.jar



spring-context-5.0.9.RELEASE-javadoc.jar



spring-context-5.0.9.RELEASE-sources.jar



spring-context-5.0.9.RELEASE.jar



spring-context-indexer-5.0.9.RELEASE-javadoc.jar



spring-context-indexer-5.0.9.RELEASE-sources.jar



spring-context-indexer-5.0.9.RELEASE.jar



spring-context-support-5.0.9.RELEASE-javadoc.jar



spring-context-support-5.0.9.RELEASE-sources.jar



spring-context-support-5.0.9.RELEASE.jar



spring-core-2.5.6.jar



spring-core-5.0.9.RELEASE-javadoc.jar



spring-core-5.0.9.RELEASE-sources.jar



spring-core-5.0.9.RELEASE.jar



spring-expression-5.0.9.RELEASE-javadoc.jar



spring-expression-5.0.9.RELEASE-sources.jar



spring-expression-5.0.9.RELEASE.jar



spring-instrument-5.0.9.RELEASE-javadoc.jar



spring-instrument-5.0.9.RELEASE-sources.jar



spring-instrument-5.0.9.RELEASE.jar



spring-security-config-3.0.2.RELEASE.jar



spring-security-core-3.0.2.RELEASE.jar



spring-security-web-3.0.2.RELEASE.jar



spring-tx-3.0.1.RELEASE.jar



spring-tx-5.0.9.RELEASE-javadoc.jar



spring-tx-5.0.9.RELEASE-sources.jar



spring-tx-5.0.9.RELEASE.jar



spring-web-2.5.6.jar



spring-web-5.0.9.RELEASE-javadoc.jar



spring-web-5.0.9.RELEASE-sources.jar



spring-web-5.0.9.RELEASE.jar




I trie the same code but this time in maven project still giving the same error and this is the pom.xml




<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.0.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>javax.servlet.jsp.jstl-api</artifactId>
<version>1.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.2</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
</exclusion>
</exclusions>
</dependency>



<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
</dependencies>






spring spring-mvc spring-security






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 10:27

























asked Nov 10 at 20:53









Tasnim Marwan

52




52












  • I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
    – moilejter
    Nov 10 at 21:01










  • i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
    – Tasnim Marwan
    Nov 10 at 21:06












  • But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
    – moilejter
    Nov 10 at 21:25


















  • I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
    – moilejter
    Nov 10 at 21:01










  • i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
    – Tasnim Marwan
    Nov 10 at 21:06












  • But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
    – moilejter
    Nov 10 at 21:25
















I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
– moilejter
Nov 10 at 21:01




I am betting the problem is you have too many versions of Spring files in your classpath - it looks like you have jars from 2.5., 3.0 and 5.0. You should pick one, and stick with it - and if this is new code, you might as well go for the newest one (which at the moment is 5.1.x?)... You might consider switching to maven, which will help take care of this versioning stuff for you.
– moilejter
Nov 10 at 21:01












i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
– Tasnim Marwan
Nov 10 at 21:06






i tried the same xml security configuration with dependency versions 5.0.1 as <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.1.0.RELEASE</version> </dependency> and still giving the same error
– Tasnim Marwan
Nov 10 at 21:06














But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
– moilejter
Nov 10 at 21:25




But do you still have all those other versions of Spring in your classpath? Maybe you could post your pom.xml here?
– moilejter
Nov 10 at 21:25

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243310%2fbeandefinitionstoreexception-in-security-xml-spring-and-security-jars-versions%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243310%2fbeandefinitionstoreexception-in-security-xml-spring-and-security-jars-versions%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues