Reputation: 23
I have a problem, i created a web application using hibernate with Derby database. This application for development phase is going to be deployed in Tomcat 7 server. This application consist on some services, daos and pojos. The thing is when i run some logic with a main as a desktop application it makes connection without any problem but when i deploy it in tomcat server i can see in logs the following stack trace
org.hibernate.exception.JDBCConnectionException: Could not open connection
at ...
at ...
Caused by: java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/calidad
at ...
at ...
Here is also hibernate mapping configuration in hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="connection.url">jdbc:derby://localhost:1527/calidad</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.generate_statistics">true</property>
<property name="show_sql">true</property>
</mapping>
</session-factory>
</hibernate-configuration>
This is for me weird because the same configuration is used in both executions. Below you can see some extract of my pom.xml about dependencies for hibernate:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.5.Final</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.7.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.7.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbynet</artifactId>
<version>10.7.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.7.1.1</version>
</dependency>
I also added manually all derby jars into lib folder of tomcat but result is the same. By the way i am working in Ubuntu 12. I hope somebody can help me
regards
Upvotes: 2
Views: 607
Reputation: 772
If you're using derbyclient then the driver should be org.apache.derby.jdbc.ClientDriver
EmbeddedDriver
is for embedded derby db
Upvotes: 2