title: Grails war deployment on Tomcat asking for hsql driver instead of mysql
body: <p>I have a grails app that I am trying to deploy onto Tomcat. I used to develop on hsql and wanted to use mysql for production. But when I build the war by running </p>
  
  <pre><code>grails prod war demo.war 
  </code></pre>
  
  <p>and deploy the created war in the tomcat/webapps directory, I get the following error </p>
  
  <pre><code>INFO: Deploying web application archive demo.war
  2011-11-29 17:30:03,193 [Thread-2] INFO  cfg.Environment  - Hibernate 3.3.1.GA
  2011-11-29 17:30:03,224 [Thread-2] INFO  cfg.Environment  - hibernate.properties not found
  2011-11-29 17:30:03,240 [Thread-2] INFO  cfg.Environment  - Bytecode provider name : javassist
  2011-11-29 17:30:03,251 [Thread-2] INFO  cfg.Environment  - using JDK 1.4 java.sql.Timestamp handling
  2011-11-29 17:31:25,451 [Thread-2] ERROR context.ContextLoader  - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': 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 create JDBC driver of class 'org.hsqldb.jdbcDriver' for connect URL 'jdbc:mysql://localhost:3306/demoapp?autoreconnect=true'
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>What's puzzling is that I have removed the hsql dependency completely from the Datasource.groovy file. Here is how my Datasource.groovy looks now. </p>
  
  <pre><code>dataSource {
      pooled = true
      driver.name = "com.mysql.jdbc.Driver"   
      username = "root"
      password = "root"
  }
  hibernate {
      cache.use_second_level_cache = true
      cache.use_query_cache = true
      cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
  }
  // environment specific settings
  environments {
      development {
          dataSource {
              dbCreate = "create-drop" // one of 'create', 'create-drop','update'
              pooled = true
              driver.name = "com.mysql.jdbc.Driver"
              url = "jdbc:mysql://localhost/demoapp_dev?autoreconnect=true"
              username = "root"
              password = ""
          }
      }
      test {
          dataSource {
              pooled = true
              driver.name = "com.mysql.jdbc.Driver"
              dbCreate = "update"
              url = "jdbc:mysql://localhost/demoapp_test?autoreconnect=true"
              username = "root"
              password = ""
          }
      }
      production {
          dataSource {
              pooled = true
              driver.name = "com.mysql.jdbc.Driver"
              dbCreate = "update"
              url = "jdbc:mysql://localhost/demoapp?autoreconnect=true"
              username = "root"
              password = ""
          }
      }
  }
  </code></pre>
  
  <p>How do I get around this problem? Any help is appreciated. </p>