0 Replies Latest reply on Apr 11, 2011 11:02 AM by Philippe Goncalves

    Drools persistence + Websphere 7 + DB2

    Philippe Goncalves Newbie

      Hi everyone,

       

      I'm trying to get the persistence of drools flow (jBPN5) working in a Websphere 7 + DB2 environment:

      - If I run a simple workflow that runs without any wait state, it's ok, I have no errors. SessionInfo is well persisted.

      - If I run a workflow with a wait state (First launch well persisted), after completing this wait state and before finishing the workflow, I have an error at line 41 of class JPAWorkItemManager:

      ((WorkItemImpl) workItem).setId(workItemInfo.getId()); // -> Nullpointer exception because of the the null returned by workItemInfo.getId()

      - If I run a workflow running (For example one with a wait state) and if I try to run another workflow in parallel, I have an error at line 141 of class SingleSessionCommandService:

      ((InternalKnowledgeRuntime) ksession).setId( this.sessionInfo.getId() ); // -> Nullpointer exception because of the the null returned by this.sessionInfo.getId()

       

      After invesgating, it seems that I have a problem once the database is locked by a process,  the persists methods from drools don't work anymore for the autogenerated columns of the tables, and then I have problems with tables SessionInfo, WorkItemInfo, etc.

       

      I instantiate the environment variable for the persistence as written in the documentation:

      ...

          public static Environment getEnvironment() {

       

              if (environment == null) {

                  EntityManagerFactory emf = Persistence.createEntityManagerFactory("testWorkflow");

                  environment = KnowledgeBaseFactory.newEnvironment();

                  environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

              }

       

              return environment;

       

          }

       

      ...

       

      And my persistence.xml file:

      <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xmlns="http://java.sun.com/xml/ns/persistence"

          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"

          version="1.0">

      <persistence-unit name="testWorkflow" transaction-type="JTA">

              <provider>org.hibernate.ejb.HibernatePersistence</provider>

              <jta-data-source>jdbc/testWorkflow</jta-data-source>

              <class>org.drools.persistence.info.SessionInfo</class>

              <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

              <class>org.jbpm.persistence.processinstance.ProcessInstanceEventInfo</class>

              <class>org.drools.persistence.info.WorkItemInfo</class>

       

              <properties>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect" />

                  <property name="hibernate.max_fetch_depth" value="5" />

                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup" />

                <property name="hibernate.hbm2ddl.auto" value="update" />

                  <property name="show_sql" value="true" />

              </properties>

       

      </persistence-unit>

      </persistence>

       

      Thanks for your help!