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