title: Groovy DataSource/BuildConfig can't find class
body: <p>I know this is a really basic question but I'm stuck here and i don't know why. So this is the situation: I am trying to connect My Grails application. I put the .jar in the lib-directory and put this code in the BuildConfig.groovy:</p>
  
  <pre><code> dependencies {
      // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
      // runtime 'mysql:mysql-connector-java:5.1.27'
       runtime 'mariadb:mariadb-java-client:1.1.5'
      // runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
  }
  </code></pre>
  
  <p>and this in my DataSource.groovy:</p>
  
  <pre><code>production {
      dataSource {
          dbCreate = "update"
          url = "jdbc:mariadb://localhost/gTunes"
          driverClassName = "org.mariadb.jdbc.Driver"
          username = "root"
          password = ""
          pooled = true
          properties {
              maxActive = -1
              minEvictableIdleTimeMillis=1800000
              timeBetweenEvictionRunsMillis=1800000
              numTestsPerEvictionRun=3
              testOnBorrow=true
              testWhileIdle=true
              testOnReturn=true
              validationQuery="SELECT 1"
          }
      }
  }
  </code></pre>
  
  <p>And this is the error im getting (basically a ClassNotFoundException:</p>
  
  <pre><code>Error |
  2014-01-21 14:04:56,120 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
  Message: org.mariadb.jdbc.Driver
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
  Error |
  2014-01-21 14:04:56,232 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
  Message: org.mariadb.jdbc.Driver
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
  Error |
  2014-01-21 14:04:56,382 [localhost-startStop-1] ERROR pool.ConnectionPool  - Unable to create initial connections of pool.
  Message: org.mariadb.jdbc.Driver
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
  Error |
  2014-01-21 14:04:56,404 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization
  Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 excepti
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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.dia
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 w
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
  Error |
  2014-01-21 14:04:56,461 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing Grails: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean f
  Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 excepti
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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.dia
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 w
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
  Error |
  2014-01-21 14:04:56,516 [localhost-startStop-1] ERROR [localhost].[/gStore]  - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsCon
  Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
      Line | Method
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 excepti
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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.dia
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | 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 w
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by SQLException: org.mariadb.jdbc.Driver
  -&gt;&gt;  262 | run       in java.util.concurrent.FutureTask
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run       in java.lang.Thread
  Caused by ClassNotFoundException: org.mariadb.jdbc.Driver
  -&gt;&gt;  366 | run       in java.net.URLClassLoader$1
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  |    355 | run       in     ''
  |    354 | findClass in java.net.URLClassLoader
  |    425 | loadClass in java.lang.ClassLoader
  |    270 | forName . in java.lang.Class
  |    262 | run       in java.util.concurrent.FutureTask
  |   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
  |    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
  ^    744 | run . . . in java.lang.Thread
     Error |
  2014-01-21 14:04:56,555 [localhost-startStop-1] ERROR core.StandardContext  - Error listenerStart
  Error |
  2014-01-21 14:04:56,602 [localhost-startStop-1] ERROR core.StandardContext  - Context [/gStore] startup failed due to previous errors
  </code></pre>
  
  <p>Thanks a lot!</p>