JBoss Community

JPAWorkingMemoryDbLogger NullPointerException

created by Csaba K in jBPM - View the full discussion

Hi,

 

I am a newbie JBPM user and I would like to get history log.

I use JBPM v5.3,I tried it with a sapmle process, and I get the Exception below:

 

Exception in thread "main" java.lang.NullPointerException

    at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.addProcessLog(JPAWorkingMemoryDbLogger.java:90)

    at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.logEventCreated(JPAWorkingMemoryDbLogger.java:65)

    at org.drools.audit.WorkingMemoryLogger.filterLogEvent(WorkingMemoryLogger.java:196)

    at org.drools.audit.WorkingMemoryLogger.beforeProcessStarted(WorkingMemoryLogger.java:421)

    at org.drools.event.ProcessEventSupport.fireBeforeProcessStarted(ProcessEventSupport.java:40)

    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcessInstance(ProcessRuntimeImpl.java:167)

    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:138)

    at org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)

    at org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1077)

    at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:315)

    at com.sample.ProcessMain.main(ProcessMain.java:25)

 

The java code:

public class ProcessMain {

 

    public static final void main(String[] args) throws Exception {

      

        KnowledgeBase kbase = readKnowledgeBase();

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

        JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);

        ksession.startProcess("com.sample.bpmn.hello");

        logger.dispose();

    }

 

 

    private static KnowledgeBase readKnowledgeBase() throws Exception {

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

        kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);

        return kbuilder.newKnowledgeBase();

    }

   

}

 

I use an in-memory H2 database, I created the three tables (process,node and variable log), the JTA datasource

is binded to this database in the jbpm-ds.xml file. My persistence.xml is the following:

 

<?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" transaction-type="JTA">

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

    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>      

    <mapping-file>META-INF/JBPMorm.xml</mapping-file>

    <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file>

 

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

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

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

 

    <class>org.jbpm.process.audit.ProcessInstanceLog</class>

    <class>org.jbpm.process.audit.NodeInstanceLog</class>

    <class>org.jbpm.process.audit.VariableInstanceLog</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="false" />

 

      <!-- for AS7 -->

      <property name="hibernate.transaction.manager_lookup_class" value="org.jbpm.integration.console.JBPMTransactionManager" />

    </properties>       

  </persistence-unit>

   

</persistence>

 

Thanks for your help!

 

Csaba

Reply to this message by going to Community

Start a new discussion in jBPM at Community