我正在开发一个使用带有 CAS 和 LDAP 的 spring 安全性的 grails 应用程序。它的配置记录在这里。当我运行时grails run-app
,一切正常,但是当我将 WAR 部署到 tomcat(或调用grails run-war
)时,我得到以下异常:
2013-10-16 11:19:47,658 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: org/springframework/security/core/authority/mapping/GrantedAuthoritiesMapper
java.lang.NoClassDefFoundError: org/springframework/security/core/authority/mapping/GrantedAuthoritiesMapper
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper
... 7 more
2013-10-16 11:19:47,658 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing Grails: org/springframework/security/core/authority/mapping/GrantedAuthoritiesMapper
java.lang.NoClassDefFoundError: org/springframework/security/core/authority/mapping/GrantedAuthoritiesMapper
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper
... 7 more
这曾经在 Tomcat 上工作,直到我添加了一些具有spring-security-core 3.1.4
传递依赖项的依赖项。我必须排除那些传递依赖才能让它运行(使用grails run-app
),它留spring-security-core 3.0.7
在类路径上,但它不会作为 WAR 运行。当我删除这些依赖项时,应用程序作为 WAR 运行良好,但我需要这些依赖项中的功能。我唯一能想到的就是我需要spring-security-core 3.1.4
。
是否有使用的 grails spring 安全插件版本spring-security-core 3.1.x
(最好是 3.1.4)?