I have created a project :
Maven / WAR / JPA2 (through hibernate) + Struts (no EJB, no EAR)
Then I created a JDBC Connection Pool to the HSQLDB (not an in-memory DB but a real one)
+ a JDBC Connection mapped on the Pool with a JNDI name like : jdbc/myDS
I then created a persitence.xml file in META-INF :
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL" >
<jta-data-source>jdbc/myDS</jta-data-source>
<class>eu.myApp.to.ServiceProvider</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.archive.autodetecion" value="hbm" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
and also (for God's sake) a glassfish-web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<resource-ref>
<res-ref-name>jdbc/my</res-ref-name>
<jndi-name>jdbc/myDS</jndi-name>
</resource-ref>
</glassfish-web-app>
It always ends up with various exceptions like :
- Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
- Exception [EclipseLink-4021] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null]. Verify that you have set the expected driver class and URL. Check your login, persistence.xml or sessions.xml resource. The jdbc.driver property should be set to a class that is compatible with your database platform
Not to mentionned that the connection parameters are ALL OK as I used the same to connect to the DB from the SwingManager.sh
Anybody to hint me into the right set up .... ?
Tx !
\T,