Using JNDI
Deploying to Tomcat
Deploying the Hibernate driver to Tomcat is very similar to deploying the JDBC driver - see Defining a JNDI Resource (Tomcat):
<!--
-->
<Resource name="jdbc/nuoDB"
auth="Container"
type="com.nuodb.jdbc.DataSource"
...
url="jdbc:com.nuodb.hib://localhost/test" />
However there is one major consideration to be aware of.
-
The Hibernate driver (prior to Jan 2021) has a dependency on Hibernate in order to throw the appropriate Hibernate exceptions.
-
If you try to use the driver without Hibernate JARs on the
CLASSPATH
, you will get aClassNotFoundException
due to the missingStateStateException
class.
This means that you must define the <Resource>
in the META-INF/context.xml
of your web-application.
You cannot declare it in CATALINA_HOME/conf/server.xml
(where CATALINA_HOME
is the Tomcat installation directory), because the Hibernate JARs are not on Tomcat’s global classpath.
Deploying to JBoss
The following instructions are for deploying the NuoDB Java Hibernate Dialect with JBoss.
-
Copy
nuodb-hibernate.jar
toJBoss_Install_Dir/modules/org/hibernate/main
. -
In the Hibernate module in
JBoss_Install_Dir/modules/org/hibernate/main/module.xml
, add the line<resource-root path="nuodb-hibernate.jar"/>
-
Copy
nuodb-jdbc.jar
toJBoss_Install_Dir/modules/com/nuodb/jdbc/main
. -
Edit
JBoss_Install_Dir/modules/com/nuodb/jdbc/main/module.xml
and add:<?xml version=1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.0" name="com.nuodb.jdbc"> <resources> <resource-root path="nuodbjdbc.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>