2015-01-18 21 views
10

Tôi đang thử thêm bảo mật mùa xuân cho dự án của mình. Tôi đang sử dụng Spring 4 và . tôi muốn sử dụng bảo mật mùa xuân 3.2 tôi có vấn đề với cấu hình: Đây là ngoại lệ của tôi:java.lang.NoSuchMethodError: org.springframework.beans.factory.support.DefaultListableBeanFactory.getDependencyComparator() Ljava/util/Comparator; "}}

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;"}} 

Và đây là cây phụ thuộc của dự án:

[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] ------------------------------------------------------------------------ 
+1

Nâng cấp phiên bản mùa xuân của bạn lên một trong các phiên bản 4.0.x mới hơn (và tôi cũng khuyên bạn nên sử dụng phiên bản Spring Security 3.2.x mới nhất). –

+0

Ngoài ra, bạn có kết hợp các phiên bản Spring vào thời gian chạy. Chắc chắn tu chạy JVM của bạn với '-verbose' để xem đường dẫn cho các lớp. Ngay cả khi SS 3.2 tương thích với SF 4.0, bạn CP có thể có phiên bản cũ hơn. Vì vậy, nó là một tác động cho bộ nạp lớp –

+0

Tôi đã thử SF 3.2 và 4.2.5 nhưng lỗi tương tự. – user2590727

Trả lời

6

tôi đã nhận lỗi này trong khi cấu hình mùa xuân dựa Ứng dụng web trong Tomcat7 (sử dụng Maven) Vấn đề này về cơ bản tồn tại do sự không tương thích phụ thuộc. Tôi đã sử dụng Spring 4.1.6 cùng với Spring-Security 3.2.x.

Nhưng bằng cách thay đổi phiên bản Spring-Security thành 4.0.0, tôi đã có thể khắc phục vấn đề. Hy vọng điều này sẽ giúp ...

+0

Làm thế nào về Tomcat8? – Siddharth

Các vấn đề liên quan