How to avoid "Unable to define Hibernate dialogs for database name [H2]!"?

I get this error on startup grails run-app:

Error during bootstrap: error while creating bean named 'messageSource': Initialization of bean failed; nested exception org.springframework.beans.factory.BeanCreationException: error creating a bean named "transactionManager": cannot resolve the link to bean 'sessionFactory' when setting the bean 'sessionFactory' property; org.springframework.beans.factory.BeanCreationException nested exception: error creating a bean named "sessionFactory": cannot resolve the bean link 'hibernateProperties' when setting the bean'hibernateProperties' property; nested exception org.springframework.beans.factory.BeanCreationException: error creating a bean named "hibernateProperties": cannot resolve the reference to bean 'dialectDetector'when setting the "properties" bean property with the key [hibernate.dialect]; nested exception org.springframework.beans.factory.BeanCreationException: error creating bean named 'dialectDetector': init method call failed; nested exception org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Failed to determine hibernation dialect for database name [H2]!

Relevant DataSource.groovy :

dataSource {
  pooled = true
  driverClassName = "org.h2.Driver"
  username = "sa"
  password = ""
  // Adding this causes a different error:
  // dialect = org.hibernate.dialect.H2Dialect
}

hibernate {
  cache.use_second_level_cache = true
  cache.use_query_cache = true
  cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}

environments {
  development {
    dataSource {
      dbCreate = "create-drop" // one of 'create', 'create-drop','update'
      url = "jdbc:h2:mem:devDB"
    }
  }
  test { // test-related stuff }
  production { // prod-related stuff }
}

When I explicitly provide the dialect as above ( org.hibernate.dialect.H2Dialect), this error occurs:

: bean 'messageSource': bean ; - org.springframework.beans.factory.BeanCreationException: bean "transactionManager": bean "sessionFactory" bean "sessionFactory"; - org.springframework.beans.factory.BeanCreationException: bean "sessionFactory": init ; - java.lang.IncompatibleClassChangeError: org.hibernate.cfg.Mappings,

- , ?

( http://jira.grails.org/browse/GRAILS-7994)

+2
5

Joda Time. . JIRA.

+3

jdk - Java 7u25 grails 2.2.1, :: Grails Hibernate

, 2.2.3, . , . , (Spring , , Grails Oracle JDK 1.7u25):

, :)

+2

Grails 2.0 , Grails 2.0, . , . .

, , , 2.0. , , :

runtime ":hibernate:$grailsVersion"
+1

Grails ? , Grails 1.3.7.

H2Dialet Hibernate.jar, 3.3.1 Grails 1.3.7, Hibernate 3.5 Grails 2.0.

, DataSource.groovy,

dialect='org.hibernate.dialect.H2DialectPatch'

Java- : , H2DialectPatch, , src/java .

0

, JDK 7 (openjdk 7u25).

Ubuntu PPA Oracle JDK: https://launchpad.net/~webupd8team/+archive/java

.

0

All Articles