Spring Security grails插件在部署为war tomcat 6时失败



我看到过一个类似的问题,但出现了与我完全相同的错误,但上下文不同。我在测试方面没有问题,相反,用户和角色创建在发布时完全失败。

当使用带有grails 1.3.7和tomcat 6的spring security core 1.2.7插件时,我会遇到以下错误:

2012-01-04 16:23:12476〔main〕错误上下文。ContextLoader-上下文初始化失败org.springframework.beans.factory.access.BootstrapException:执行引导时出错;嵌套异常为org.codehaus.groovy.runtime.InvokerInvocationException:groovy.lang.MissingMethodException:方法的无签名:setTest.Role.save()适用于参数类型:(java.util.LinkedHashMap)值:[[flush:true]]可能的解决方案:wait()、any()、wait(long)、any网址:org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContext Loader.java:87)…

该应用程序在使用grails runApp启动时运行良好,但在war’ing时,每次都无法部署。错误似乎集中在我在引导程序中创建的用户帐户/角色上:

def adminRole = new Role(authority: 'ROLE_ADMIN').save(flush: true)
def userRole = new Role(authority: 'ROLE_USER').save(flush: true)
def testUser = new User(username: 'me', enabled: true, password: 'password')
testUser.save(flush: true)
UserRole.create testUser, adminRole, true

这直接取自springSecurity教程。有什么建议吗?

编辑:此外,grails prod-run-war也会失败,它与角色/用户创建直接相关。即使用户和角色的名称不同,问题仍然存在。

编辑2:同样,失败在.save()上,当然原始错误消息显示了这一点。我验证了常规.save()与save(flush:true)没有区别。

编辑3:似乎这可能是当前版本插件中的一个错误:http://jira.grails.org/browse/GPSPRINGSECURITYCORE-152我会随时通知你们的!

编辑4:已确认,恢复到1.2.6版本似乎可以解决问题!

是否运行命令s2 quickstart

Config.groovy设置正确吗?

grails.plugins.springsecurity.userLookup.userDomainClassName="....User"
grails.plugins.springsecurity.userLookup.authorityJoinClassName="....UserRole"
grails.plugins.springsecurity.authority.className="....Role"

这似乎是当前版本插件中的一个错误:http://jira.grails.org/browse/GPSPRINGSECURITYCORE-152

我恢复到1.2.6,没有任何问题。希望这对其他人有帮助(我知道我为此损失了两个小时)!

最新更新