<br><font size=2 face="Trebuchet MS">Hi Kris,</font>
<br><font size=2 face="Trebuchet MS">Thanks for your reply.</font>
<br><font size=2 face="Trebuchet MS">This problem was solved. It was because
I was not completing the workItem using the kession object. Because of
that I was getting NPE in JPAWorkItemManager.java</font>
<br>
<br><font size=2 face="Trebuchet MS">After that when I made changes to
my code I got the same exception but this time it is in MarshallerReaderContext.java</font>
<br>
<br><font size=2 color=#000080 face="Courier New"><u>caused by :java.lang.NullPointerException</u></font>
<br><font size=2 color=red face="Courier New">
at org.drools.marshalling.impl.MarshallerReaderContext.resolveClass(</font><font size=2 color=#000080 face="Courier New"><u>MarshallerReaderContext.java:78</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at java.io.ObjectInputStream.readClassDesc(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at java.io.ObjectInputStream.readObject0(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at java.io.ObjectInputStream.readObject(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.marshalling.impl.InputMarshaller.readWorkItem(</font><font size=2 color=#000080 face="Courier New"><u>InputMarshaller.java:830</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.persistence.processinstance.WorkItemInfo.getWorkItem(</font><font size=2 color=#000080 face="Courier New"><u>WorkItemInfo.java:86</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(</font><font size=2 color=#000080 face="Courier New"><u>JPAWorkItemManager.java:91</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(</font><font size=2 color=#000080 face="Courier New"><u>CompleteWorkItemCommand.java:46</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.command.runtime.process.CompleteWorkItemCommand.execute(</font><font size=2 color=#000080 face="Courier New"><u>CompleteWorkItemCommand.java:12</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.persistence.session.SingleSessionCommandService.execute(</font><font size=2 color=#000080 face="Courier New"><u>SingleSessionCommandService.java:254</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.drools.command.impl.CommandBasedStatefulKnowledgeSession$1.completeWorkItem(</font><font size=2 color=#000080 face="Courier New"><u>CommandBasedStatefulKnowledgeSession.java:119</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.ofbiz.drools.event.drool.HumanWorkItemHandler.createApplication(</font><font size=2 color=#000080 face="Courier New"><u>HumanWorkItemHandler.java:302</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at sun.reflect.NativeMethodAccessorImpl.invoke0(</font><font size=2 color=#000080 face="Courier New"><u>Native
Method</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at java.lang.reflect.Method.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">
at org.ofbiz.drools.event.drool.HumanWorkItemHandler.runTask(</font><font size=2 color=#000080 face="Courier New"><u>HumanWorkItemHandler.java:257</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.ofbiz.drools.event.drool.CommonDrool.commonHumanTaskMethod(</font><font size=2 color=#000080 face="Courier New"><u>CommonDrool.java:56</u></font><font size=2 color=red face="Courier New">)</font>
<br><font size=2 color=red face="Courier New">
at org.ofbiz.humanres.drool.CreateAndAprrove.createHrJobPostingRequest(</font><font size=2 color=#000080 face="Courier New"><u>CreateAndAprrove.java:42</u></font><font size=2 color=red face="Courier New">)</font>
<br>
<br><font size=2 face="Trebuchet MS">Do you have any Idea about this why
I am getting this exception.</font>
<br>
<br><font size=2 face="Trebuchet MS">Thanks & Regards<br>
<br>
Pardeep Ruhil<br>
</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="Trebuchet MS"><b>Kris Verlaenen <kris.verlaenen@cs.kuleuven.be></b>
</font>
<p><font size=1 face="Trebuchet MS">11/09/2009 05:23 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">To</font></div>
<td><font size=1 face="Trebuchet MS">Rules Users List <rules-users@lists.jboss.org>,
<Pardeep.Ruhil@lntinfotech.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="Trebuchet MS">Subject</font></div>
<td><font size=1 face="Trebuchet MS">Re: [rules-users] Drools Flow : Persistence
:- Getting Null Pointer Exception in JPAWorkItemManager.java</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>How are you calling completeWorkItem (could you show
me the entire stack<br>
trace)? When you use persistence, you must make sure all (asynchronous)<br>
invocations to the engine go through the session (as that will make sure<br>
the entity manager is created and changes get persisted afterwards). As<br>
a result, if your work item is completed asynchronously, you should<br>
complete it using ksession.getWorkItemManager().completeWorkItem(..)<br>
(and not using the WorkItemManager reference you got during<br>
executeWorkItem(..) as that is for synchronous use only).<br>
<br>
Kris<br>
<br>
Quoting Pardeep.Ruhil@lntinfotech.com:<br>
<br>
> Hi,<br>
> When I try to run a sample test case using drools-persistence.jar
it<br>
> works <br>
> successfully.<br>
> But when I try to include the persistence in my OFBiz application,
I<br>
> am <br>
> getting null pointer exception in class JPAWorkItemManager.java.<br>
> <br>
> java.lang.NullPointerException <br>
> at <br>
><br>
org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(<br>
> JPAWorkItemManager.java:85).<br>
> <br>
> Null Pointer is because of getting EntityManager object as NULL. In<br>
> the <br>
> below line of JPAWorkItemManager.java<br>
> EntityManager em = (EntityManager) this.workingMemory<br>
> .getEnvironment().get( EnvironmentName.ENTITY_MANAGER );<br>
> the em is null.<br>
> Because of this I am getting Null Pointer exception when it try to<br>
> run the <br>
> code<br>
> if (workItemInfo == null) {<br>
> workItemInfo
= em.find(WorkItemInfo.class, id);<br>
> }<br>
> <br>
> Can you tell me why I getting NPE when I try to run the jar file in<br>
> my <br>
> application.<br>
> While the code run successfully when I try to run sample test case<br>
> for <br>
> that.<br>
> Please help me to get through the situation.<br>
> <br>
> <br>
> Thanks & Regards<br>
> <br>
> Pardeep Ruhil<br>
> L&T Infotech Ltd<br>
> Mumbai<br>
> Ph: +919820283884<br>
> <br>
> Larsen & Toubro Infotech Ltd.<br>
> www.Lntinfotech.com<br>
> <br>
> This Document is classified as: <br>
> <br>
> L&T Infotech Proprietary L&T Infotech Confidential
L&T Infotech <br>
> Internal Use Only L&T Infotech General Business <br>
> <br>
> This Email may contain confidential or privileged information for
the<br>
> <br>
> intended recipient (s) If you are not the intended recipient, please<br>
> do <br>
> not use or disseminate the information, notify the sender and delete<br>
> it <br>
> from your system. <br>
> <br>
> ______________________________________________________________________<br>
<br>
<br>
<br>
<br>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
<br>
______________________________________________________________________<br>
</font></tt>
<br>
<BR>
______________________________________________________________________<BR>