title: Grails error while connecting mysql
body: <p>i am getting following error while connecting to mysql </p>
  
  <p>i have copied mysql-connector-java-5.1.22-bin.jar to lib folder in my application</p>
  
  <pre><code>| Error 2012-11-26 16:14:16,981 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error executing bootstraps: 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run       in java.lang.Thread
  
  Caused by ClassNotFoundException: com.mysql.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    423 | loadClass in java.lang.ClassLoader
  |    356 | 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
  |   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    722 | run . . . in java.lang.Thread
  </code></pre>