-
1. Re: jBPM5.1 : History Information and Reporting using API
sandeepsapra Nov 22, 2011 11:43 PM (in response to sandeepsapra)Can anyone please help me for my query on how to implement Process Event Listener and show history information.?
Regards,
Sandeep Sapra
-
2. Re: jBPM5.1 : History Information and Reporting using API
sandip.bhoi Nov 24, 2011 10:26 AM (in response to sandeepsapra)We want to log all activities performed in the process workflow as the Process definition mostly contains all Human Tasks.
Please help us.
-
3. Re: jBPM5.1 : History Information and Reporting using API
calca Nov 24, 2011 10:36 AM (in response to sandip.bhoi)Hi.
You can use https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bam/src/main/java/org/jbpm/process/audit/JPAProcessInstanceDbLog.java to get information from audit tables.
Demian
-
4. Re: jBPM5.1 : History Information and Reporting using API
sandip.bhoi Nov 24, 2011 11:23 AM (in response to calca)Thank you Demian.
But after replacing the line
JPAWorkingMemoryDbLogger jpaLogger = new JPAWorkingMemoryDbLogger(ksession);
with
JPAProcessInstanceDbLog jpaLogger = new JPAProcessInstanceDbLog (ksession.getEnvironment());
Could not see any significant logging records added in PROCESSINSTANCEINFO and PROCESSINSTANCELOG.
Could you please let me know the relevant API call to retrive the history details for perticular workflow executed.
-
5. Re: jBPM5.1 : History Information and Reporting using API
calca Nov 24, 2011 11:28 AM (in response to sandip.bhoi)Hi Sandip,
both should be there.
JPAWorkingMemoryDbLogger will register a listener and log in the database.
JPAProcessInstanceDbLog just queries these tables.
-
6. Re: jBPM5.1 : History Information and Reporting using API
sandip.bhoi Nov 24, 2011 11:59 AM (in response to calca)Hi Demian,
Sorry for being so dump
What could be the wrong with following code. I am getting NPE.
public void init() throws ServletException {
super.init();
try {
UserTransaction ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction");
ut.begin();
StatefulKnowledgeSession ksession = JbpmAPIUtil.getSession();
/* Create the knowledge base */
JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger (ksession);
JPAProcessInstanceDbLog processInstaceLogger = new JPAProcessInstanceDbLog (ksession.getEnvironment());
CommandBasedWSHumanTaskHandler taskHandler = new CommandBasedWSHumanTaskHandler(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", taskHandler);
taskHandler.connect();
ut.commit();
logger.dispose();
processInstaceLogger.dispose();
} catch (Throwable t) {
// log.error(t.getMessage(), t.getCause());
throw new RuntimeException("error while creating session", t);
}
}
Nov 24, 2011 10:26:14 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
java.lang.RuntimeException: error while creating session
at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:43)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1190)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.jbpm.process.audit.JPAProcessInstanceDbLog.dispose(JPAProcessInstanceDbLog.java:165)
at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:40)
... 12 more
Nov 24, 2011 10:26:14 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /OrderFactoryWeb threw load() exception
java.lang.NullPointerException
at org.jbpm.process.audit.JPAProcessInstanceDbLog.dispose(JPAProcessInstanceDbLog.java:165)
at com.sample.processserver.TaskProcessServlet.init(TaskProcessServlet.java:40)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1190)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1103)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1010)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Nov 24, 2011 10:26:14 PM org.apache.solr.servlet.SolrServlet init
INFO: SolrServlet.init()
-
7. Re: jBPM5.1 : History Information and Reporting using API
calca Nov 24, 2011 12:09 PM (in response to sandip.bhoi)It seems to be a bug in dispose method, which is solved in master:
em is null because you never used it.
Anyway, to use this Process instance Log,
you can just use processInstaceLogger.find<Process/Node/Variable>Instances method to get the information you need.
-
8. Re: jBPM5.1 : History Information and Reporting using API
sandip.bhoi Nov 24, 2011 1:43 PM (in response to calca)Thank you Demian.
It Works !
-
9. Re: jBPM5.1 : History Information and Reporting using API
calca Nov 24, 2011 2:06 PM (in response to sandip.bhoi)Great, plz mark question as resolved