Grails 2.4.4 with MySql

634 views
Skip to first unread message

Ruslan Jonusas

unread,
Mar 8, 2015, 2:10:25 PM3/8/15
to grails-de...@googlegroups.com
I am having an annoying time trying to set up Grails with mysql, it's so annoying that I want to start hating grails. 

But lets not go there, so I need some help with this nonsense. 

I am getting this errors 


Error |
2015-03-08 13:58:00,674 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial
Caused by ClassNotFoundException: com.mysql.jdbc.Driver.

Error |
2015-03-08 13:58:00,763 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial

Caused by ClassNotFoundException: com.mysql.jdbc.Driver.

2015-03-08 13:58:02,215 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
Message: com.mysql.jdbc.Driver.

Caused by ClassNotFoundException: com.mysql.jdbc.Driver.
->>  372 | run       in java.net.URLClassLoader$1



I have looked around for a long time, and none of the solutions has helped me so far. Which is  very frustrating. 

This are my settings 

dataSource {
    pooled
= true
    driverClassName
= "com.mysql.jdbc.Driver."
    dialect
= "org.hibernate.dialect.MySQL5InnoDBDialect"
}
hibernate
{
    cache
.use_second_level_cache = true
    cache
.use_query_cache = true
    cache
.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
   
//  cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
   
//  cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
   
//  singleSession = true // configure OSIV singleSession mode
   
// flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}

// environment specific settings
environments
{
    development
{
        dbCreate
= "create" // one of 'create', 'create-drop', 'update', 'validate', ''
        url
= "jdbc:mysql://localhost:3306/gamereview"
        username
= "root"
        password
= "********"
   
}
    hibernate
{
        show_sql
= true
}



Build file 


grails.project.dependency.resolver = "maven" // or ivy
grails
.project.dependency.resolution = {
   
// inherit Grails' default dependencies
    inherits
("global") {
       
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
       
// excludes 'ehcache'
   
}
    log
"warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums
true // Whether to verify checksums on resolve
    legacyResolve
false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

    repositories
{
        inherits
true // Whether to inherit repository definitions from plugins

        grailsPlugins
()
        grailsHome
()
        mavenLocal
()
        grailsCentral
()
        mavenCentral
()
       
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
        mavenRepo
"http://mvnrepository.com"
        mavenRepo
"http://snapshots.repository.codehaus.org"
        mavenRepo
"http://repository.codehaus.org"
        mavenRepo
"http://download.java.net/maven/2/"
        mavenRepo
"http://repository.jboss.com/maven2/"
   
}

    dependencies
{
       
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        runtime
'mysql:mysql-connector-java:5.1.34'
       
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
       
// test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
   
}

    plugins
{
       
// plugins for the build system only
        build
":tomcat:7.0.55"

       
// plugins for the compile step
        compile
":scaffolding:2.1.2"
        compile
':cache:1.1.8'
        compile
":asset-pipeline:1.9.9"

       
// plugins needed at runtime but not for compilation
        runtime
":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
        runtime
":database-migration:1.4.0"
        runtime
":jquery:1.11.1"

       
// Uncomment these to enable additional asset-pipeline capabilities
       
//compile ":sass-asset-pipeline:1.9.0"
       
//compile ":less-asset-pipeline:1.10.0"
       
//compile ":coffee-asset-pipeline:1.8.0"
       
//compile ":handlebars-asset-pipeline:1.3.0.3"
}




I have no files in libs folder. I have tried putting it in and changing the build config file, all in vain. Clearing cache, deleting ivy file, as well as .grails folder. Refreshing dependencies and so much more. 
I have tested the connection URL in IntelliJ and it works fine, I can connect and work with the DB, so that is not an issue. 


It is horrible, and so much time spend being unproductive, which is completely the opposite of what this frameworks claims to be! Leaves a bitter taste, and I have only just started learning it.

Robert Stagner

unread,
Mar 8, 2015, 5:46:24 PM3/8/15
to grails-de...@googlegroups.com
I'm no Grails expert, but from reviewing the exception and what appears to be your DataSource.groovy snippet, it looks like you have a typo. 

You have
driverClassName = "com.mysql.jdbc.Driver."

When it should be
driverClassName = "com.mysql.jdbc.Driver" (without the trailing period)
Reply all
Reply to author
Forward
0 new messages