hibernate - Grails突然抛出错误无法确定数据库名称的Hibernate方言

标签 hibernate grails

我正在使用 chalice 在版本 2.2.0 在 Ubuntu 上运行了一段时间,一切都很顺利。我的应用程序运行良好。我昨天将我的 JDK 更新为 1.7.0_25,我确信这只是我所做的改变。从那时起,我所有的应用程序在调用 run-app 时都会抛出错误(底部的堆栈跟踪)。

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

我在一个项目上摆弄 webxml 插件,但我认为这不会弄乱其他应用程序。我使用 git 进行版本控制,即使我回到稳定提交,错误仍然出现。

有趣的是,如果我运行应用程序 来自 IntelliJ Idea ,它就像一个魅力 .但我真的很想使用 clasic 命令行工具。

IntelliJ 使用以下命令启动应用程序:
/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

我也尝试删除 ~/.grails/2.2.0/projects/Diagnostics 但这没有帮助。

任何想法有什么问题?我好绝望

谢谢你的帮助。

堆栈跟踪:
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

最佳答案

这是由于 1.7.0_25 中的更改导致使用 Spring 加载时出现问题。它已在 Grails 2.2.3 中修复,因此升级到该问题将解决此问题。见 http://jira.grails.org/browse/GRAILS-10183

关于hibernate - Grails突然抛出错误无法确定数据库名称的Hibernate方言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17293763/

相关文章:

mysql - Grails DetachedCriteria 使用 'where' 抛出 SyntaxErrorException

grails - 在运行测试用例时,为属性指定了不存在的映射属性[none]

hibernate - JPA/Hibernate 删除实体有时不起作用

java - 将新实体添加到持久化集合中

java - 按其他条件选择和排序列表(Criteria inside join hibernate)

grails - Controller 集成测试 grails3 : services are not getting injected

Grails 3 拦截器并呈现自定义 JSON View

java - 使用 Spring 自定义唯一用户名验证

java - Memcached 与 Hibernate 的集成

grails - 如何更改 Grails 3 中的每个插件编解码器?