Grails突然抛出错误无法确定数据库名称的Hibernate方言 [英] Grails suddenly throws error Could not determine Hibernate dialect for database name

查看:88
本文介绍了Grails突然抛出错误无法确定数据库名称的Hibernate方言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

 无法确定Hibernate方言数据库名称[H2]! #或PostgresSQL如果使用postgres 

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



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

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-I-1-1.7.798/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support .GrailsS​​tarter --main org.codehaus.groovy.grails.cli.GrailsS​​criptRunner --conf /usr/share/grails/2.2.0/conf/groovy-starter.conf run-app 

I也尝试删除〜/ .grails / 2.2.0 / projects / Diagnostics,但这并没有帮助。



任何想法有什么问题吗?我很绝望。



感谢您的帮助。
$ b Stacktrace

  2013-06-25 11:19:59,754 [localhost-startStop-1]错误context.GrailsContextLoader  - 初始化Grails时出错:创建名为' transactionManagerPostProcessor':bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]! 
消息:创建名为'transactionManagerPostProcessor'的bean时出错:bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用;嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]!
Line |方法
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中

导致BeanCreationException:创建名为'transactionManager'的bean时出错:无法在设置bean属性'sessionFactory'时解析对bean'sessionFactory'的引用。嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]!
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中

引发BeanCreationException:创建名为'sessionFactory'的bean时出错:在设置bean属性'hibernateProperties'时无法解析对bean'hibernateProperties'的引用;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置Bean属性'属性'来引用bean'dialectDetector';嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]!
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中

由BeanCreationException引发:创建名为'hibernateProperties'的bean时出错:无法使用键[hibernate.dialect]设置bean属性'properties'时对bean'dialectDetector'的引用。嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名为'dialectDetector'的bean时出错:init方法的调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]!
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中

由BeanCreationException引发:创建名为'dialectDetector'的bean时出错:初始化方法调用失败;嵌套异常是org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException:无法确定数据库名称的Hibernate方言[H2]!
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中

由CouldNotDetermineHibernateDialectException引起:无法确定数据库名称的Hibernate方言[H2]!
- >> 334 | innerRun in java.util.concurrent.FutureTask $ Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 |在java.util.concurrent.FutureTask
|运行1145 | java.util.concurrent.ThreadPoolExecutor中的runWorker
| 615 |在java.util.concurrent.ThreadPoolExecutor $ Worker
^ 724 |中运行跑 。 。 。在java.lang.Thread中


解决方案

这是由于在使用弹簧加载时导致问题的1.7.0_25中更改。它在Grails 2.2.3中得到了修复,所以升级到这个版本就可以解决这个问题。请参阅 http://jira.grails.org/browse/GRAILS-10183


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

解决方案

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

这篇关于Grails突然抛出错误无法确定数据库名称的Hibernate方言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆