【问题标题】:Grails 2.4.3 and Spring Security 2.0 RC4 installationGrails 2.4.3 和 Spring Security 2.0 RC4 安装
【发布时间】:2014-10-04 13:23:09
【问题描述】:

刚开始学习 Grails。我想使用spring security插件所以我在BuildConfig.groovy中复制以下内容

plugins {
      …
    compile ':spring-security-core:2.0-RC4'
     …
}

如此处所述http://grails.org/plugin/spring-security-core。 之后,我执行grails compile,因此会出现一条消息通知我插件已正确安装。然后我输入grails s2-quickstart app.ejem Person Authority,再次,一切正常。但是当我运行该应用程序时,我发现了以下错误:

|Loading Grails 2.4.3
   |Configuring classpath
    .
    |Environment set to development
    .................................
    |Packaging Grails application
    ...........
    |Compiling 4 source files
    ..............................
    |Running Grails application
    Configuring Spring Security Core ...
    ... finished configuring Spring Security Core
    Error |
    2014-08-11 18:02:51,924 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table person_authority drop constraint FK_7d2mdh76otecbaoaq5y9p12ar if exists
    Error |
    2014-08-11 18:02:51,935 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Tabla "PERSON_AUTHORITY" no encontrada
    Table "PERSON_AUTHORITY" not found; SQL statement:
    alter table person_authority drop constraint FK_7d2mdh76otecbaoaq5y9p12ar if exists [42102-176]
    Error |
    2014-08-11 18:02:51,936 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - HHH000389: Unsuccessful: alter table person_authority drop constraint FK_kdi2d7ujicv663k0h6mv85jx3 if exists
    Error |
    2014-08-11 18:02:51,981 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport  - Tabla "PERSON_AUTHORITY" no encontrada
    Table "PERSON_AUTHORITY" not found; SQL statement:
    alter table person_authority drop constraint FK_kdi2d7ujicv663k0h6mv85jx3 if exists [42102-176]
    |Server running. Browse to http://localhost:8080/ejem

当我检查 url 时一切正常,但注销控制器显示错误 405 页面。当我检查 /dbconsole 时,所有表似乎都是正确的,如果我在 Bootstrap.groovy 文件中设置了一些用户......这是某种错误吗?

问候。

【问题讨论】:

    标签: spring grails spring-security


    【解决方案1】:

    我连续 3 天遇到和你一样的问题(我是 grails 的新手,解决这类问题非常复杂)。 我读到它在 Hibernate 中是一个问题。 可以按照以下任何说明轻松解决:

    1. 将以下行添加到位于Config.groovy 的 log4j 闭包中

    致命的'org.hibernate.tool.hbm2ddl.SchemaExport'

    1. DataSource.groovy中,将开发环境改为

    dbCreate = "更新"

    使用第二个选项是因为 Grails 运行自己的虚拟数据库,它指的是首先更新内容以防它没有创建

    PS:对不起,如果有人不能正确理解我的回答,但是尝试用英语解释一些这样的话题有点困难,因为它不是我的母语,但我正在尽我所能:P

    【讨论】:

      【解决方案2】:

      这实际上是 Hibernate 中的一个错误,请参阅 https://jira.grails.org/browse/GRAILS-11198https://hibernate.atlassian.net/browse/HHH-7002。可以安全地忽略这些错误,因此您可以抑制输出。

      Config.groovy 中,将以下行添加到 log4j 闭包中:

      fatal  'org.hibernate.tool.hbm2ddl.SchemaExport'
      

      这并不能真正解决任何问题,但同样,由于输出是由错误引起的,您现在可以放心地忽略错误。

      如果你愿意,也可以fix the bug locally

      【讨论】:

        猜你喜欢
        • 2015-08-01
        • 2012-02-01
        • 2014-11-21
        • 2014-11-24
        • 2014-09-24
        • 1970-01-01
        • 2014-10-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多