How do I avoid 'Could not determine Hibernate dialect for database name [H2]!'?

后端 未结 5 2042
情歌与酒
情歌与酒 2020-12-12 01:46

I am getting this error when running grails run-app:

Error executing bootstraps: Error creating bean with name \'messageSource\': Initi

相关标签:
5条回答
  • 2020-12-12 02:23

    Which version of Grails are you using? I believe you are using Grails 1.3.7.

    The H2Dialet has a few bugs from the Hibernate.jar which is 3.3.1 in Grails 1.3.7, it is included in Hibernate 3.5 and Grails 2.0.

    My solution is, in your DataSource.groovy, use this

    dialect='org.hibernate.dialect.H2DialectPatch'
    

    and download the Java class from here : Source Code, change its class name to H2DialectPatch to avoid confusing, put it in your src/java folder.

    0 讨论(0)
  • 2020-12-12 02:26

    I just upgraded to Grails 2.0, and was experiencing the same issue, but if I created a brand new Grails 2.0 project there were no such problems. I leave this answer for any who might be experience the same. It's important to ensure the right hibernate libraries are being used.

    If like me you were upgrading an existing project, I recommend comparing the config files of your existing project with those of a brand new 2.0 project. Doing this you will see that the build config file should include a hibernate plugin:

    runtime ":hibernate:$grailsVersion"
    
    0 讨论(0)
  • 2020-12-12 02:33

    This was a bug in the Joda Time Plugin. See the mentioned JIRA issue for details.

    0 讨论(0)
  • 2020-12-12 02:43

    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.

    0 讨论(0)
  • 2020-12-12 02:45

    If jdk is Java 7u25 and grails 2.2.1, may be a solution:: Grails suddenly throws error Could not determine Hibernate dialect for database name

    The information that the error is fixed in grails 2.2.3 is correct. I tested it and it worked. A point to be made is (Spring loaded causes Grails to fail to bootstrap using Oracle JDK 1.7u25):

    I hope you find it useful :)

    0 讨论(0)
提交回复
热议问题