[rules-users] Resuming Flow: NPE when completing a work item

Mauricio Salatino salaboy at gmail.com
Tue Apr 13 16:53:07 EDT 2010


Hi nanic23,
Can you provide us more information about your test case?
Are you sure that the sessionId is the correct one? the knowledgeBase
provided is the correct one, and the env too?

ksession = JPAKnowledgeService.
loadStatefulKnowledgeSession(
rwi.getSessionId(), knowledgeBase, null, env );

would be nice also to see what are you doing in the following method:

 registerWorkItemHandlers((
WorkItemManager) ksession
                               .getWorkItemManager(), ksession);



On Tue, Apr 13, 2010 at 4:19 PM, tolitius <webakaunt at gmail.com> wrote:

>
> @nanic23,
>
>   It seems that when trying to complete the work item, internally Drools
> Flow is using JPA persistence module to find ( retrieve ) a work item to be
> completed from a WorkItemInfo table.
>
>   Interestingly enough, if you look at the "getWorkItem" method of the
> "org.drools.persistence.processinstance.WorkItemInfo", it passes a NULL for
> a RuleBase while setting up a context:
>
>    public WorkItem getWorkItem() {
>        if ( workItem == null ) {
>            try {
>                ByteArrayInputStream bais = new ByteArrayInputStream(
> workItemByteArray );
>                MarshallerReaderContext context = new
> MarshallerReaderContext( bais,
>
>
> null,  // THIS IS a RULEBASE <<<<<<<<<<<<<
>
>
> null,
>
> null );
>                workItem = InputMarshaller.readWorkItem( context );
>
>   And right after that, when trying to set parameters on the work item, it
> uses that RuleBase in MarshallerReaderContext:
>
>
>    protected Class< ? > resolveClass(ObjectStreamClass desc) throws
> IOException, ClassNotFoundException {
>        String name = desc.getName();
>        try {
>
>            return Class.forName(name, false,
> this.ruleBase.getRootClassLoader()); // HERE IS WHERE THE NULL POINTER
> EXCEPTION OCCURS <<<<<<<<<<<<<<<<<<<<<<< since the RuleBase is NULL
>
>        } catch (ClassNotFoundException ex) {
>            return super.resolveClass( desc );
>        }
>    }
>
>    I am not sure why it is not passing a RuleBase in case of
> "JPAWorkItemManager.completeWorkItem", but that is how it behaves.
>
>    I think Kris would be a good guy to explain the reason / the approach
> that should be taken.
>
> /Anatoly
> --
> View this message in context:
> http://n3.nabble.com/Resuming-Flow-NPE-when-completing-a-work-item-tp716847p717055.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100413/1e6ae04b/attachment.html 


More information about the rules-users mailing list