当前位置: 首页 > 知识库问答 >
问题:

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

钦永贞
2023-03-14

我在Ubuntu上使用grails 2.2.0版有一段时间了,一切都很顺利。我的应用程序运行良好。昨天我将JDK更新为1.7.0_25,我确信这是我做的唯一更改。从那时起,所有我的应用程序在调用run应用程序时都会出错(底部的stacktrace)。

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

共有3个答案

王俊楚
2023-03-14

看来问题与JDK 7(openjdk 7u25)的版本有关。

另一种选择是为Oracle JDK使用Ubuntu PPA:https://launchpad.net/~webupd8team/archive/java

这对我很有效,解决了问题。

别子实
2023-03-14

用OpenJDK1.6.x替换OpenJDK11.7.x似乎已经解决了这个问题(Ubuntu 13.04)。

暨嘉
2023-03-14

这是由于1.7.0_25中的一项更改导致在使用Spring加载时出现问题。Grails 2.2.3中已经修复了这个问题,所以升级到Grails 2 . 2 . 3将会修复这个问题。参见http://jira.grails.org/browse/GRAILS-10183

 类似资料:
  • 问题内容: 我在Ubuntu的 2.2.0* 版本中使用 grails 已有一段时间,一切都进行得很好。我的申请运行正常。昨天我将JDK更新为1.7.0_25,我敢肯定那只是我所做的更改。从那时起,我的所有应用程序在调用run- app时都会引发错误(底部的stacktrace)。 * 我在一个项目上摆弄了webxml插件,但我认为这不会搞乱其他应用程序。我使用git进行版本控制,即使我返回稳定的

  • 我正在尝试使用NuoDB构建一个基于gorm的时髦项目。但是收到此错误 - 无法确定数据库名称 [NuoDB] 的Hibernate方言! 奇怪的是,它与mysql一起工作。因此,我最初的怀疑是NuoDB的数据库配置,但我检查并重新检查了配置参数,如这里提供的NuoDB文档所示 我还将grails-datastore-gorm-hibernate 4版本从1.1.0升级到3.1.1.RELEASE

  • 问题内容: 运行时出现此错误: 执行引导程序时出错:创建名称为’messageSource’的bean时出错:初始化bean失败;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建名称为’transactionManager’的bean时出错:设置bean属性’sessionFactory’时无法解析对bean’sess

  • 下面列出了可能导致这些错误的几个因素 我试图通过使用Intel HAXM和GenyMotion来加快模拟器的速度。我可以看到build.gradle的依赖关系发生了变化 渐变老的 是依赖项的更改导致生成错误还是其他原因。

  • 我在这里完全不知所措。我在外置硬盘上有一个项目叫做LenseProject。在LenseProject中,我有

  • 我正在用Hibernate和Websphere application Server 8.0开发一个应用程序。 我已经在Websphere中创建了一个数据源,它可以成功地与数据库连接。 但从应用程序我得到以下错误: 系统错误创建会话:org。冬眠服务jndi。JndiException:无法查找JNDI名称[java:comp/env/jdbc/OracleDS] 以下是我所做的设置: Websp