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

tolitius webakaunt at gmail.com
Tue Apr 13 16:19:12 EDT 2010


@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.



More information about the rules-users mailing list