title: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.postgresql.Driver'
body: <p>I'm having trouble to migrate from an oracle db web-app context to a postgresql db web-app context.</p>
  
  <p>I'm having a simple java spring-mvc web-app with flyway to init the database process and hibernate to manage objects. This web-app was initialiy think to use a oracle database and I'm trying to use a postgresql base instead, but I'm pretty new with this base and not confortable with the declaration of the datasource. May be you will find what's wrong.</p>
  
  <p>I'm using tomcat apache server (v6) within eclipse plugin to debug my webapp.</p>
  
  <p>When I'm trying to run my web-app on my server, the server failed to start with this log : </p>
  
  <pre><code>11:23:57.903 [main] INFO  o.h.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
  11:23:57.903 [main] INFO  o.h.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata
  11:23:57.903 [main] ERROR o.h.tool.hbm2ddl.SchemaUpdate - HHH000319: Could not get database metadata
  org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.postgresql.Driver'
  at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136) ~[tomcat-dbcp.jar:na]
  at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) ~[tomcat-dbcp.jar:na]
  [...]
  Caused by: java.lang.UnsupportedClassVersionError: org/postgresql/Driver : Unsupported major.minor version 51.0
  </code></pre>
  
  <p>I've add the driver to my pom.xml</p>
  
  <pre><code>   &lt;dependency&gt;
          &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
          &lt;version&gt;9.4-1200-jdbc41&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>and made the </p>
  
  <pre><code>   mvn eclipse:eclipse 
  </code></pre>
  
  <p>I'm using a datasource declared in my META-INF directory :</p>
  
  <pre><code>   &lt;Context&gt;
        &lt;Resource name="jdbc/BlankAppDataSource"
          auth="Container"
          type="javax.sql.DataSource"
          username="postgres"
          password="postgres"
          driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://localhost:5432/my_schema" 
  /&gt;
  </code></pre>
  
  <p></p>
  
  <p>I've even added the driver .jar to my tomcat lib directory  (CATALINA_HOME/lib).</p>
  
  <p>Thanks by advance.</p>
  
  <p>Regards,
  Romain.</p>