1

Just starting learning Grails. I want to use the spring security plugin so I copy the following in BuildConfig.groovy

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

As stated here http://grails.org/plugin/spring-security-core. After that, I do grails compile so a message informs me that the plugin is correctly installed. Then I type grails s2-quickstart app.ejem Person Authority and, again, all ok. but when I run the app I found the following errors:

|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

When I check the url all is ok but the logout controller that shows an error 405 page. All tables seems correct when I check /dbconsole, also if I setup some users in the Bootstrap.groovy file... Is this some kind of bug??

Regards.

tim_yates
  • 167,322
  • 27
  • 342
  • 338
RoberMP
  • 1,306
  • 11
  • 22

2 Answers2

1

It is actually a bug in Hibernate, see https://jira.grails.org/browse/GRAILS-11198 and https://hibernate.atlassian.net/browse/HHH-7002. The errors can be safely ignored, so you can just suppress the output.

In Config.groovy, add the following line to the log4j closure:

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

This won't really fix anything, but again, since the output is due to a bug, you can safely ignore the errors for now.

You can also fix the bug locally if you want to.

Community
  • 1
  • 1
dpcasady
  • 1,826
  • 12
  • 30
1

I had the same problem as you for like 3 straight days (Im new in grails and its quite of complicated to solve this types of problems). I read that its a problem in Hibernate. It can be easily solved by following any of these instructions:

  1. Adding the following line to the log4j closure located in the Config.groovy

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

  1. In the DataSource.groovy, change the development enviroment to

dbCreate = "update"

The second option is used because Grails runs its own Virtual Database and it refers to first update the content in case that its not created

PS: Sorry if someone could not understand properly my answer, but its kind of difficult trying to explain some topics like this in English because its not my native language but im doing my best :P

Carlos VR
  • 35
  • 6