About persistence in jBPM5
cross.cy Nov 30, 2011 7:13 PMHi,
I'm running a test workflow in a standard Java Application, without using and container or web server. I followed the Configuring Persistence section of the user guide carefully. However I encountered a javax.naming.NameNotFoundException saying "Name testDS1 not found". In my program i have :
PoolingDataSource ds1 = new PoolingDataSource();
ds1 = new PoolingDataSource();
ds1.setUniqueName("jdbc/testDS1");
ds1.setClassName("org.h2.jdbcx.JdbcDataSource");
ds1.setMaxPoolSize(3);
ds1.setAllowLocalTransactions(true);
ds1.getDriverProperties().put("user", "sa");
ds1.getDriverProperties().put("password", "");
ds1.getDriverProperties().put("URL", "jdbc:h2:tcp://localhost/~/test");
ds1.init();
My persistence.xml is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence
version="1.0"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.jbpm.persistence.jpa">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/testDS1</jta-data-source>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
It looks like ds1.setUniqueName("jdbc/testDS1") didn't work. Any suggestion? Thanks!
Best regards
Yu