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 [email protected]: > 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 _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
