<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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at java.io.ObjectInputStream.readClassDesc(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at java.io.ObjectInputStream.readObject0(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at java.io.ObjectInputStream.readObject(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
at java.lang.reflect.Method.invoke(Unknown Source)</font>
<br><font size=2 color=red face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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">&nbsp; &nbsp; &nbsp; &nbsp;
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 &amp; 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 &lt;kris.verlaenen@cs.kuleuven.be&gt;</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 &lt;rules-users@lists.jboss.org&gt;,
&lt;Pardeep.Ruhil@lntinfotech.com&gt;</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)? &nbsp;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). &nbsp;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>
&gt; Hi,<br>
&gt; When I try to run a sample test case using drools-persistence.jar
it<br>
&gt; works <br>
&gt; successfully.<br>
&gt; But when I try to include the persistence in my OFBiz application,
I<br>
&gt; am <br>
&gt; getting null pointer exception in class JPAWorkItemManager.java.<br>
&gt; <br>
&gt; java.lang.NullPointerException <br>
&gt; &nbsp;at <br>
&gt;<br>
org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(<br>
&gt; JPAWorkItemManager.java:85).<br>
&gt; <br>
&gt; Null Pointer is because of getting EntityManager object as NULL. In<br>
&gt; the <br>
&gt; below line of JPAWorkItemManager.java<br>
&gt; &nbsp; EntityManager em = (EntityManager) this.workingMemory<br>
&gt; .getEnvironment().get( EnvironmentName.ENTITY_MANAGER );<br>
&gt; the em is null.<br>
&gt; Because of this I am getting Null Pointer exception when it try to<br>
&gt; run the <br>
&gt; code<br>
&gt; &nbsp;if (workItemInfo == null) {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; workItemInfo
= em.find(WorkItemInfo.class, id);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &nbsp;<br>
&gt; Can you tell me why I getting NPE when I try to run the jar file in<br>
&gt; my <br>
&gt; application.<br>
&gt; While the code run successfully when I try to run sample test case<br>
&gt; for <br>
&gt; that.<br>
&gt; Please help me to get through the situation.<br>
&gt; <br>
&gt; <br>
&gt; Thanks &amp; Regards<br>
&gt; <br>
&gt; Pardeep Ruhil<br>
&gt; L&amp;T Infotech Ltd<br>
&gt; Mumbai<br>
&gt; Ph: +919820283884<br>
&gt; <br>
&gt; Larsen &amp; Toubro Infotech Ltd.<br>
&gt; www.Lntinfotech.com<br>
&gt; <br>
&gt; This Document is classified as: <br>
&gt; <br>
&gt; L&amp;T Infotech Proprietary &nbsp; L&amp;T Infotech Confidential
&nbsp; L&amp;T Infotech <br>
&gt; Internal Use Only &nbsp; L&amp;T Infotech General Business <br>
&gt; <br>
&gt; This Email may contain confidential or privileged information for
the<br>
&gt; <br>
&gt; intended recipient (s) If you are not the intended recipient, please<br>
&gt; do <br>
&gt; not use or disseminate the information, notify the sender and delete<br>
&gt; it <br>
&gt; from your system. <br>
&gt; <br>
&gt; ______________________________________________________________________<br>
<br>
<br>
<br>
<br>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
<br>
______________________________________________________________________<br>
</font></tt>
<br>
<BR>
______________________________________________________________________<BR>