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>
spring spring-mvc spring-security
add a comment |
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>
spring spring-mvc spring-security
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
add a comment |
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>
spring spring-mvc spring-security
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
spring spring-mvc spring-security
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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