Use my own H2 database with camunda

699 views
Skip to first unread message

t.yell...@gmail.com

unread,
May 15, 2015, 2:10:08 PM5/15/15
to camunda-...@googlegroups.com
Hello,

I tried the "Java EE Process Applications" (http://goo.gl/0nEzS8) tutorial which worked fine. But I had problems to use my own H2 database in this environment. In the tutorial the camunda database ProcessEngine is used with this persistence.xml:

-->
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
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">

<persistence-unit name="primary">
<jta-data-source>java:jboss/datasources/ProcessEngine</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>

</persistence>
<--

I tried now to use my own database with this persistence.xml:

-->
<?xml version="1.0" encoding="UTF-8"?>
<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="tickets">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.driver_class" value="org.h2.Driver" />
<property name="hibernate.connection.url" value="jdbc:h2:~/my-app-h2db"/>
<property name="hibernate.connection.username" value="sa" />
<property name="hibernate.connection.password" value="" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
</properties>
</persistence-unit>

</persistence>
<--

But this results in many errors when I try to deploy. I think the central errors are:

-->
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver org.h2.Driver class not found
[...]
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.h2.Driver]
[...]
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.h2.Driver
<--

But I checked... the driver jar "h2-1.3.160.jar" is in "/Maven Dependencies" in my maven project.

So can you help me what I did wrong?

Many thanks!

Christian Lipphardt

unread,
May 16, 2015, 4:02:23 AM5/16/15
to camunda-...@googlegroups.com
Hi,

Did you check the WEB-INF/lib folder of the resulting WAR artifact if
the H2 library is included?
Sorry if I ask this question but I dont know what you mean with '/Maven
Dependencies'. Is this some kind of maven-related display in your IDE?

Cheers,
Christian
signature.asc
Message has been deleted

t.yell...@gmail.com

unread,
May 16, 2015, 6:49:17 AM5/16/15
to camunda-...@googlegroups.com
Hi Christian,

thanks for your help. Yes, '/Maven Dependencies' is Eclipse showing the dependencies from pom.xml. I rechecked now and updated my dependency to a newer version:
-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.187</version>
</dependency>
<--
Now the error disappeared and a new appeared:
-->
12:35:45,495 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 66) HHH000231: Schema export unsuccessful: java.sql.SQLException: No suitable driver found for jdbc:h2:~/my-app-h2db
<--

Am I missing additional dependencies?

Thanks!
Reply all
Reply to author
Forward
0 new messages