Hi ,
when i run the below code with 2 or more thread i am getting deadlock error.
below attached "persistence.xml, jndi prop and datasource code". Kindly help
to solve the error
public static final void main(String[] args){
KnowledgeBuilder knowledgeBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add(ResourceFactory.newClassPathResource("samplerulefile.rf"),
ResourceType.DRF);
KnowledgeBase kbase = knowledgeBuilder.newKnowledgeBase();
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
BitronixTransactionManager transactionManager =
TransactionManagerServices.getTransactionManager();
env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new
NotificationWorkItemHandler());
JPAWorkingMemoryDbLogger auditlog = new JPAWorkingMemoryDbLogger(ksession);
ProcessInstance p = (ProcessInstance) ksession.startProcess("ruleid",null);
auditlog.dispose();
ksession.dispose();
}
*
persistence.xml: *
<?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.drools.persistence.jpa">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/processInstanceDS</jta-data-source>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.OracleDialect" />
<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>
*jndi property:*
java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
*datasource:*
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/processInstanceDS");
ds.setClassName("oracle.jdbc.xa.client.OracleXADataSource");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().put("user", "username");
ds.getDriverProperties().put("password", "password");
ds.getDriverProperties().put("URL","jdbc:oracle:thin:@192.168.1.115:1521:TEST");
ds.setAllowLocalTransactions(true);
ds.init();
Regards
Dhinesh
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Drools-Ruleflow-deadlock-is...
Sent from the Drools: User forum mailing list archive at
Nabble.com.