0

I am using below gradle build script to test the sample application.

using this script ran gradle init command, then

gradle grails-run-app

command it compiles but failed with this message. " 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.BeanCreat
ionException: 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 'hibernateProper
ties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hib
ernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.spr
ingframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.gr
oovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!

But if I run grails run-app, it works. looks like something is missing from gradle.build file. can you help me to fix this error message?

gradle -v

------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------

Build time:   2013-12-17 09:28:15 UTC
Build number: none
Revision:     36ced393628875ff15575fa03d16c1349ffe8bb6

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:          2.2.0
JVM:          1.6.0_24 (Sun Microsystems Inc. 20.0-b12)
OS:           Linux 2.6.32-358.23.2.el6.i686 i386

build script:

 cat build.gradle
buildscript {
        repositories {
            mavenCentral()
            maven { url 'http://repo.grails.org/grails/repo' }
        }
        dependencies {
            classpath "org.grails:grails-gradle-plugin:2.0.0-SNAPSHOT"
        }
}
repositories {
    mavenCentral()
    maven { url 'http://repo.grails.org/grails/repo'  }
}
version = "1.0"
apply plugin: "grails"
apply plugin: 'idea'
grails {
  grailsVersion = "2.3.4"
}
dependencies {
    ['dependencies', 'core', 'spring', 'web', 'plugin-datasource', 'plugin-domain-class', 'plugin-controllers', 'plugin-services'].each { plugin ->
        compile "org.grails:grails-$plugin:2.3.2"
    }
    compile 'org.grails.plugins:tomcat:7.0.47'
    compile 'org.grails.plugins:hibernate:3.6.10.6'
    compile 'com.h2database:h2:1.3.173'
    bootstrap "org.codehaus.groovy:groovy-all:2.1.9"
}
sfgroups
  • 18,151
  • 28
  • 132
  • 204
  • http://stackoverflow.com/questions/7336107/how-do-i-avoid-could-not-determine-hibernate-dialect-for-database-name-h2 –  Dec 19 '13 at 17:28

1 Answers1

0

I think you did not create the New Schema in MySQL WorkBench.Create new schema name, like in DataSource.groovy
file

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93