I'm having trouble to migrate from an oracle db web-app context to a postgresql db web-app context.
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.
I'm using tomcat apache server (v6) within eclipse plugin to debug my webapp.
When I'm trying to run my web-app on my server, the server failed to start with this log :
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
I've add the driver to my pom.xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
</dependency>
and made the
mvn eclipse:eclipse
I'm using a datasource declared in my META-INF directory :
<Context>
<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"
/>
I've even added the driver .jar to my tomcat lib directory (CATALINA_HOME/lib).
Thanks by advance.
Regards, Romain.