14

I was using grails in version 2.2.0 on Ubuntu for some time and everything went good. My application ran fine. I updated my JDK to 1.7.0_25 yesterday and I'm sure that's only change I did. Since then all my apps throws error when run-app is called (stacktrace on the bottom).

Could not determine Hibernate dialect for database name [H2]! # or PostgresSQL if postgres is used

I was fiddling with webxml plugin on one project but I don't think that would mess up the other applications. I use git for version control and even if I go back to stable commits the error still appears.

Funny thing is that if I run the app from IntelliJ Idea, it works like a charm. But I really want to use clasic command line tool.

IntelliJ start app with this command:

/usr/lib/jvm/java-7-oracle/bin/java -Dgrails.home=/usr/share/grails/2.2.0 -Dbase.dir=/home/freeman/Dokumenty/cms/plugins/Diagnostics -Dtools.jar=/usr/lib/jvm/java-7-oracle/lib/tools.jar -Dgroovy.starter.conf=/usr/share/grails/2.2.0/conf/groovy-starter.conf -Xmx512M -XX:MaxPermSize=192m -Didea.launcher.port=7533 -Didea.launcher.bin.path=/home/freeman/programy/idea-IU-117.798/bin -Dfile.encoding=UTF-8 -classpath /usr/share/grails/2.2.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.0.5.jar:/usr/share/grails/2.2.0/dist/grails-bootstrap-2.2.0.jar:/home/freeman/programy/idea-IU-117.798/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /usr/share/grails/2.2.0/conf/groovy-starter.conf run-app

I also tried to remove ~/.grails/2.2.0/projects/Diagnostics but that didn't help.

Any ideas what is wrong with it? I'm prette desperate.

Thanks for your help.

Stacktrace:

2013-06-25 11:19:59,754 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing Grails: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        |    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread
Frank
  • 859
  • 11
  • 24
  • Same here, same upgrade, same error. I use Netbeans instead of IntelliJ, and had the same error from within Netbeans. Once I explicitly added a path to the h2*.jar files (I have multiple in my environment) to the overall Netbeans libraries, I can run the app from within Netbeans. I still can't figure out how to make the command line work but maybe this helps. – Silberling Jun 25 '13 at 10:54
  • Thank you for your answer. I guess there is some mess with class paths. I haven't found solution though. – Frank Jun 25 '13 at 12:31
  • I have the same problem and I'm using grails-2.2.3 :-( – Mauro Jul 18 '13 at 11:24

5 Answers5

15

This is due to a change in 1.7.0_25 which causes a problem when using spring-loaded. It's fixed in Grails 2.2.3, so upgrading to that will fix this. See http://jira.grails.org/browse/GRAILS-10183

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
  • I upgraded and the problem disappeared (I had to do it manually because the newest version for apt-get is 2.2.0 :-/). Anyway, you saved me couple of hours. Thank you very much! – Frank Jun 25 '13 at 18:22
  • 3
    Use http://gvmtool.net/ - it's the replacement for the apt-get support and is updated very quickly. – Burt Beckwith Jun 25 '13 at 18:53
  • 2
    with Grails 2.2.3 It is still broken for OpenJDK 1.7.0_25 on Linux, Oracle's JDK does work though. – aeischeid Jul 19 '13 at 18:34
  • 1
    I resolved the problem by upgrading java from 1.7.0_25 to 1.7.0_45. – Halil Dec 04 '13 at 18:53
1

Replacing OpenJDK 1.7.x with OpenJDK 1.6.x seems to have solved it for me (Ubuntu 13.04).

Marius K
  • 498
  • 5
  • 6
1

It seems that the problem is related to the version of JDK 7 (openjdk 7u25).

Alternative is to use Ubuntu PPA for Oracle JDK: https://launchpad.net/~webupd8team/+archive/java

which worked fine for me and solved the problem.

Jacob
  • 3,580
  • 22
  • 82
  • 146
0

If upgrading is an issue I posted a comment on the grails bug for a (non destructive) workaround which at least in my case works with 2.2.1:

http://jira.grails.org/browse/GRAILS-10183?focusedCommentId=76068&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-76068

  • Download springloaded-core-1.1.3.jar and store it locally (I store it in my source tree so that it gets checked in)
  • Edit grailsw

    #### start of hack to workaround GRAILS-10183 (http://jira.grails.org/browse/GRAILS-10183)
    SPRINGLOADED_CORE_1_1_3="../../local-maven-repo/org/springsource/springloaded/springloaded-core/1.1.3/springloaded-core-1.1.3.jar"
    STARTER_CLASSPATH="$SPRINGLOADED_CORE_1_1_3:wrapper/grails-wrapper-runtime-2.2.1.jar:wrapper:."
    #STARTER_CLASSPATH="wrapper/grails-wrapper-runtime-2.2.1.jar:wrapper:."
    #### end of hack to workaround GRAILS-10183 (http://jira.grails.org/browse/GRAILS-10183)
    

Now when you use the grails wrapper springloaded core 1.1.3 is first in the classpath and it just works. Since both the jar file and grailsw are checked in with the source tree, anybody who checks it out benefits from the fix which is better than asking everybody to hack their local grails install.

yan
  • 2,932
  • 1
  • 23
  • 25
0

A new install of Grails 2.3.4 on Fedora 18 had the same issue from me. The solution in my case (thanks to the comment from Halil) was to upgrade to JDK 1.7.0_45.

GSP
  • 3,763
  • 3
  • 32
  • 54