title: Application tests can connect to and query database but Maven can't load driver
body: <p>Spring MVC app has Oracle and Hibernate properties in a file like this (persistence-oracle.properties):</p>
  
  <pre><code># jdbc.X
  jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
  jdbc.url=[Database URL]
  jdbc.user=[Username]
  jdbc.pass=[Password]
  
  # hibernate.X
  hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
  hibernate.show_sql=true
  #hibernate.hbm2ddl.auto=create-drop
  </code></pre>
  
  <p>And while the tests show that the app can connect to and query the database and get data back, when I try to package it with maven, I get this error:</p>
  
  <pre><code>Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
  java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
  </code></pre>
  
  <p>The reason the properties are in this properties file and not hibernate.cfg.xml is because configuration is done via Spring Java Configuration similar to <a href="http://www.javacodegeeks.com/2013/05/hibernate-4-with-spring.html" rel="nofollow">step 3 here</a></p>
  
  <p>Why can't Maven find the driver while Spring can?</p>
  
  <p><strong>Edit1: Oracle dependency</strong></p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.oracle&lt;/groupId&gt;
      &lt;artifactId&gt;ojdbc6&lt;/artifactId&gt;
      &lt;version&gt;11.2.0.3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>