简体   繁体   English

生产中运行的grails Web应用程序出现问题:“无此类属性:保存为类:JsecRole”

[英]Problem with grails web app running in production: “No such property: save for class: JsecRole”

I've got a grails 1.1 web app running great in development but when I try and run it in production with an sqlserver database it crashes in a weird way. 我有一个grails 1.1 Web应用程序,它在开发中运行良好,但是当我尝试在生产环境中使用sqlserver数据库运行它时,它会以一种奇怪的方式崩溃。

The relevant part of my datasource.groovy is as follows: 我的datasource.groovy的相关部分如下:

environments {
    development {
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'create-drop','update'
            url = "jdbc:hsqldb:mem:devDB"
        }
    }
    test {
        dataSource {
            dbCreate = "update"
            url = "jdbc:hsqldb:mem:testDb"
        }
    }
    production {

        dataSource {
            dbCreate = "update"
            driverClassName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
            endUsername = "sa"
            password = "pw4db"
            url = "jdbc:sqlserver://localhost:1433;databaseName=ReleasePlanner;selectMethod=cursor"       

The error message I receive is: 我收到的错误消息是:

Message: No such property: save for class: JsecRole
Caused by: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole
Class: ProjectController
At Line: [28]
Code Snippet:
27: println "###about to create project roles"
28: userManagerService.createProjectRoles(project)
29: userManagerService.addUserToProject(session.user.id.toString(), project, 'owner')       
        }
    }
}

The stacktrace is as follows: stacktrace如下:

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole

    at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)

    at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)

Caused by: groovy.lang.MissingPropertyException: No such property: save for class: JsecRole

    at UserManagerService.createProjectRoles(UserManagerService.groovy:9)

    at UserManagerService$$FastClassByCGLIB$$6fa73713.invoke(<generated>)

    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)

    at UserManagerService$$EnhancerByCGLIB$$fcf60984.createProjectRoles(<generated>)

    at UserManagerService$createProjectRoles.call(Unknown Source)

    at ProjectController$_closure4.doCall(ProjectController.groovy:28)

    at ProjectController$_closure4.doCall(ProjectController.groovy)

    ... 2 more

Any help is appreciated. 任何帮助表示赞赏。

Thanks Sarah 谢谢莎拉

I fixed my problem by deleting my database and creating a new database. 我通过删除数据库并创建新数据库来解决问题。 I think some of the fields in my database weren't mapping correctly as I changed my domain objects. 我认为在更改域对象时,数据库中的某些字段未正确映射。 The error didn't really point me in this direction though! 错误并没有真正指向我这个方向!

Sarah 莎拉

This problem is discussed in this thread on the Grails mailing list. Grails邮件列表上的该线程中讨论了此问题。 It is supposed to be fixed in Grails 1.2. 它应该在Grails 1.2中修复。 A workaround for earlier versions of Grails is to add the following to Bootstrap.groovy 较早版本的Grails的解决方法是将以下内容添加到Bootstrap.groovy中

JsecRole.get(-1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM