And another tip is that after ksession.startProcess, I get a ProcessInstance pi, but

ProcessInstance pi = ksession.startProcess("com.zyeeda.system.TestFlow");
org.drools.process.instance.ProcessInstance pi2 = (org.drools.process.instance.ProcessInstance) pi;
pi2.getWorkingMemory() // this one returns null

Is this a bug or my usage problem?

On Sun, Nov 7, 2010 at 5:51 PM, tangrui.cn@gmail.com <tangrui.cn@gmail.com> wrote:
Hi list,

The attachment is a very simple test case to demonstrate an application using Drools Persistence JPA (5.1.1).

Usage:

1. set up a mysql database called framework
2. set the user/password are root/root (or change the bitronix-datasources.properties file)
3. run maven test

The core lines are as following:

StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, conf, env);
ProcessInstance pi = ksession.startProcess("com.zyeeda.system.TestFlow");
pi.signalEvent("signal", "goon");

When executing the 3rd line, an exception occurred

java.lang.NullPointerException
    at org.drools.process.instance.impl.ProcessInstanceImpl.getProcess(ProcessInstanceImpl.java:67)
    at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.getWorkflowProcess(WorkflowProcessInstanceImpl.java:185)
    at org.drools.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:346)
    at com.zyeeda.test.AppTest.testProcessPersistence(AppTest.java:84)

I've headed into the code and find that some working memory related to the ProcessInstanceImpl is null.
(drools-core/src/main/java/org/drools/process/instance/impl/ProcessInstanceImpl.java)

But I cannot get why this does happen. Please give me some tips.

I tried to google some solutions, but find only this one (http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Flow-Events-Not-Working-td1453738.html), but it seems that he solved this problem by using a custom command.

Thank you!

--
唐睿



--
唐睿