Grails 2.4.3和Spring Security 2.0 RC4安装

时间:2014-08-11 16:25:11

标签: spring grails spring-security

刚开始学习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文件中设置了一些用户......这是某种错误吗?

问候。

2 个答案:

答案 0 :(得分:1)

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

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

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

这不会真正解决任何问题,但同样,由于输出是由于错误导致的,因此您现在可以安全地忽略错误。

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

答案 1 :(得分:1)

我和你一样有同样的问题,连续3天(我是grails的新手,而且解决这类问题非常复杂)。 我读到它在Hibernate中存在问题。 遵循以下任何说明都可以轻松解决:

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

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

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

      dbCreate ="更新"

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

      PS:很抱歉,如果有人无法理解我的答案,但是很难用英语解释一些这样的话题,因为它不是我的母语,但我尽我所能:P

相关问题