title: Grails Running App errors since added Databaseconnection
body: <p>Hello Dear Programmers,</p>
  
  <p>I'm learning to work with Groovy / Grails with the eBook "Grails - A Quick Start Guide" and now im working there with an example project called TekDays. Every step for this project is documented and well described but i cant find an fault i made.. 
  I'm using the Grovvy / Grails Tool Suite (GGTS) as IDE. </p>
  
  <ul>
  <li>Grails Version: 2.2.4</li>
  <li>Groovy/Grails Tool Suite Version: 3.4.0.RELEASE   </li>
  </ul>
  
  <p>Everything worked fine but since I added the database connection to my MySQL database I'm getting this error:</p>
  
  <pre><code>| Loading Grails 2.2.4
  | Configuring classpath.
  | Environment set to development.....
  | Packaging Grails application.....
  | Running Grails application
  | Error 2014-01-07 10:29:32,352 [localhost-startStop-1] ERROR    context.GrailsContextLoader  - Error initializing the application: 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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
      Line | Method
  -&gt;&gt;  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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt;  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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt;  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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt;  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.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt;  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 MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt;  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 SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
  -&gt;&gt; 1429 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   1371 | createDataSource in     ''
  |   1044 | getConnection in     ''
  |    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 ClassNotFoundException: com.mysql.jdbc.Driver
  -&gt;&gt;   59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    424 | loadClass in java.lang.ClassLoader
  |    357 | loadClass in     ''
  |   1420 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
  |   1371 | createDataSource in     ''
  |   1044 | getConnection in     ''
  |    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
  </code></pre>
  
  <p>This is the <code>DataSource.groovy</code> file where i added the database connection like it's done in the eBook: </p>
  
  <pre><code>dataSource {
      pooled = true
      driverClassName = "com.mysql.jdbc.Driver"
      username = "admin"
      password = "root"
  }
  hibernate {
      cache.use_second_level_cache = true
      cache.use_query_cache = false
      cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
  }
  // environment specific settings
  environments {
      development {
          dataSource {
              dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
              url = "jdbc:mysql://localhost:3306/:tekdays"
          }
      }
      test {
           dataSource {
               dbCreate = "update"
               url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
           }
      }
      production {
          dataSource {
              dbCreate = "update"
              url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
              pooled = true
              properties {
                 maxActive = -1
                 minEvictableIdleTimeMillis=1800000
                 timeBetweenEvictionRunsMillis=1800000
                 numTestsPerEvictionRun=3
                 testOnBorrow=true
                 testWhileIdle=true
                 testOnReturn=true
                 validationQuery="SELECT 1"
              }
          }
      }
  }
  </code></pre>
  
  <p><code>BuildConfig.groovy</code> :</p>
  
  <pre><code>grails.servlet.version = "2.5" // Change depending on target container compliance (2.5  or 3.0)
  grails.project.class.dir = "target/classes"
  grails.project.test.class.dir = "target/test-classes"
  grails.project.test.reports.dir = "target/test-reports"
  grails.project.target.level = 1.6
  grails.project.source.level = 1.6
  //grails.project.war.file = "target/${appName}-${appVersion}.war"
  
  // uncomment (and adjust settings) to fork the JVM to isolate classpaths
  //grails.project.fork = [
  //   run: [maxMemory:1024, minMemory:64, debug:false, maxPerm:256]
  //]
  
  grails.project.dependency.resolution = {
      // inherit Grails' default dependencies
      inherits("global") {
          // specify dependency exclusions here; for example, uncomment this to disable  ehcache:
          // excludes 'ehcache'
      }
      log "error" // 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()
          grailsCentral()
  
          mavenLocal()
          mavenCentral()
  
          // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
          //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.22'
      }
  
      plugins {
          runtime ":hibernate:$grailsVersion"
          runtime ":jquery:1.8.3"
          runtime ":resources:1.2"
  
          // Uncomment these (or add new ones) to enable additional resources capabilities
          //runtime ":zipped-resources:1.0"
          //runtime ":cached-resources:1.0"
          //runtime ":yui-minify-resources:0.1.5"
  
          build ":tomcat:$grailsVersion"
  
          runtime ":database-migration:1.3.2"
  
          compile ':cache:1.0.1'
      }
  }
  </code></pre>
  
  <p>If more information is needed, I will add it as fast as i can.</p>
  
  <p>Thank you very much for every helpful answer or comment!</p>