6 Replies Latest reply on Jan 26, 2012 5:55 AM by sebb

    jbpm console doesnt see process instance that was started by java

    sebb

      So here is my setup:

       

      - jbpm 5.2 installer

      - executed ant install.demo

      - executed ant start.demo

      - executed evaluation sample process in eclipse

      - opened jbpm console

       

      Result: I cant see the evaluation process instance in the console.

       

      I browsed the forum and found that you have to use the JPAWorkingMemoryDbLogger. But when using the JPA logger I get a nullpointer:

       

      java.lang.NullPointerException

          at org.jbpm.process.audit.JPAWorkingMemoryDbLogger.addVariableLog(JPAWorkingMemoryDbLogger.java:124)

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

       

      So I guess something is still wrong. What do I have to configure after a plain install of the jbpm 5.2 installer in order to make the history log work? The documentation is unclear in chapter 7 since it just shows one file to modify and not the initial setup.

       

      Any hints are appreciated, thanks =)

        • 1. Re: jbpm console doesnt see process instance that was started by java
          pmancham

          I think you have to start the process from jbpm-console to see that in the reports.

           

          If you just want history, then you have to enable persistence in your java app that is running processes.

           

          EntityManagerFactory emf =

                              Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");

                      Environment env = KnowledgeBaseFactory.newEnvironment();

                      env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

                      // create a new knowledge session that uses JPA to store the runtime state

                      StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);

                      JPAWorkingMemoryDbLogger dblogger = new JPAWorkingMemoryDbLogger(ksession);

                      KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "test", 1000);

                      ksession.getWorkItemManager().registerWorkItemHandler("myWorkItem", new MyWorkItemHandler());

                      int sessionId = ksession.getId();

                      ProcessInstance pi = (ProcessInstance) ksession.startProcess(processId);

                      System.out.println("Process started ... sessionId = " + sessionId + " processId = " + pi.getId());

                      logger.close();

                      dblogger.dispose();

                      ksession.dispose();

           

          If you are using junit tests, then have a look at JBPMHelper.java in source code of jbpm5.2

          1 of 1 people found this helpful
          • 2. Re: jbpm console doesnt see process instance that was started by java
            sebb

            Thanks, that helped a lot. I think the console should see processes from java code if I get the history log to work. I saw this quote in another thread:

             

            Demian Calcaprina:

            Jbpm console looks the processes in history logs database

            Maybe I can confirm this, but the history log still does not work. I added the code you mentioned and created a META-INF dir to place the persistence.xml I found in the documentation. Now I get another exception:

             

            javax.naming.NameNotFoundException: unable to find a bound object at name 'jdbc/processInstanceDS'

            Thats quite interesting since this object is used in the persistence.xml I used.

             

            I add a screenshot of my workspace (plain jbpm installer 5.2 sample with modifications that are mentioned in this thread) so you can see what I could have done wrong.

             

            myWorkspace.png(click me to zoom in)

            • 3. Re: jbpm console doesnt see process instance that was started by java
              pmancham

              If you are deploying in jboss AS7, then you have to make sure that

              a) the datasource is defined in standalone.xml file

              b) Use your own transaction manager lookup class (not BTMTransactionManagerLookup) in persistence.xml [Look at https://community.jboss.org/message/646526#646526]

              1 of 1 people found this helpful
              • 4. Re: jbpm console doesnt see process instance that was started by java
                pmancham
                • 5. Re: jbpm console doesnt see process instance that was started by java
                  pmancham

                  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.jbpm.persistence.jpa" transaction-type="JTA">

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

                          <jta-data-source>java:jboss/datasources/jbpm-ds</jta-data-source>

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

                          <mapping-file>META-INF/Taskorm.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.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>

                          <class>org.jbpm.task.Attachment</class>

                          <class>org.jbpm.task.Content</class>

                          <class>org.jbpm.task.BooleanExpression</class>

                          <class>org.jbpm.task.Comment</class>

                          <class>org.jbpm.task.Deadline</class>

                          <class>org.jbpm.task.Comment</class>

                          <class>org.jbpm.task.Deadline</class>

                          <class>org.jbpm.task.Delegation</class>

                          <class>org.jbpm.task.Escalation</class>

                          <class>org.jbpm.task.Group</class>

                          <class>org.jbpm.task.I18NText</class>

                          <class>org.jbpm.task.Notification</class>

                          <class>org.jbpm.task.EmailNotification</class>

                          <class>org.jbpm.task.EmailNotificationHeader</class>

                          <class>org.jbpm.task.PeopleAssignments</class>

                          <class>org.jbpm.task.Reassignment</class>

                          <class>org.jbpm.task.Status</class>

                          <class>org.jbpm.task.Task</class>

                          <class>org.jbpm.task.TaskData</class>

                          <class>org.jbpm.task.SubTasksStrategy</class>

                          <class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>

                          <class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>

                          <class>org.jbpm.task.User</class>

                          <properties>

                              <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="edu.apollogrp.platform.jBpmUtil.MyTransactionManagerLookup"/>

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

                          </properties>

                      </persistence-unit>

                   

                   

                  </persistence>

                  • 6. Re: jbpm console doesnt see process instance that was started by java
                    sebb

                    Thanks again for the answers.

                     

                    I used your persistence.xml, created my own lookup class (which I referenced in your persistence.xml) and found the datasource in the standalone.xml (I had to remove the "-" in jbpm-ds), but it still doesnt work.

                    But I think I found the problem why it doesnt work:

                    Prasanth Manchambhatla schrieb:

                     

                    If you are deploying in jboss AS7, then you have to make sure that

                    The jbpm console is deployed in AS7, but the code which starts the process engine is not. And I dont want to deploy it there either. So I think I have to add something to the persistence.xml that takes care of the remote part... I will look into it.