Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoSuchMethodError:org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator";}}_Java_Spring_Spring Mvc - Fatal编程技术网

java.lang.NoSuchMethodError:org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator";}}

java.lang.NoSuchMethodError:org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator";}},java,spring,spring-mvc,Java,Spring,Spring Mvc,我正在尝试将spring安全性添加到我的项目中。我使用的是Spring4,我想使用SpringSecurity3.2。我的配置有问题: 这是我的例外: Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource

我正在尝试将spring安全性添加到我的项目中。我使用的是Spring4,我想使用SpringSecurity3.2。我的配置有问题: 这是我的例外:

Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;
    Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator()Ljava/util/Comparator;"}}
这是项目的依赖关系树:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building engineering-project-web Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ engineering-project-web ---
[INFO] com.pawel:engineering-project-web:war:0.0.1-SNAPSHOT
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile
[INFO] +- org.springframework:spring-context:jar:4.0.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:4.0.0.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.2.0.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-core:jar:3.2.0.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:4.0.0.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:4.0.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-context-support:jar:4.0.0.RELEASE:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.7.4:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.5:runtime
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:runtime
[INFO] +- log4j:log4j:jar:1.2.15:runtime
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] \- junit:junit:jar:4.7:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.654 s
[INFO] Finished at: 2015-01-18T14:38:19+01:00
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------

我在Tomcat7(使用Maven)中配置基于Spring的Web应用程序时遇到了这个错误。 这个问题基本上是因为依赖关系不兼容而存在的。我使用的是Spring4.1.6和SpringSecurity 3.2.x

但是通过将Spring安全版本更改为4.0.0,我能够解决这个问题。
希望这有助于……

将您的spring版本升级到较新的4.0.x版本之一(我建议您也使用最新的spring Security 3.2.x版本)。此外,您在运行时还可以混合使用spring版本。请务必使用
-verbose
运行JVM以查看类的路径。即使SS3.2与SF4.0兼容,您也可以使用旧版本。因此,这对classloaderI来说是一个影响,我尝试了SF3.2和4.2.5,但同样的错误。Tomcat8呢?