Bug 724237 (BRMS-181)

Summary: StatelessKnowledgeSessions created by KnowledgeAgent causes NullPointerException when used in a pipeline
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: nwallace <nwallace>
Component: unspecifiedAssignee: Mark Proctor <mark.proctor>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: high    
Version: unspecified   
Target Milestone: ---   
Target Release: 5.0.1   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/BRMS-181
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
5.0.1.SNAPSHOT for May 12, 2009
Last Closed: 2009-09-01 12:29:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description nwallace 2009-07-07 15:28:28 UTC
Date of First Response: 2009-09-10 01:37:38
securitylevel_name: Public

This issue is related to this thread on the user-list:  http://www.mail-archive.com/rules-users@lists.jboss.org/msg08770.html

I'm getting a NullPointerException when I insert an object into
the pipeline using 5.0.1.SNAPSHOT from May 12, 2009:
java.lang.NullPointerException
        at 
org.drools.runtime.pipeline.impl.StatelessKnowledgeSessionPipelineImpl.insert(StatelessKnowledgeSessionPipelineImpl.java:24)

It looks like StatelessKnowledgeSession's ruleBase is null when created by the KnowledgeAgent, which poses a problem since StatelessKnowledgeSessionPipelineImpl invokes getRootClassLoader() on the session's ruleBase.

Here's what I'm doing:
StatelessKnowledgeSession ksession = kagent.newStatelessKnowledgeSession();
Pipeline pipeline =
PipelineFactory.newStatelessKnowledgeSessionPipeline(ksession);
pipeline.setReceiver(messageTransformer);
pipeline.insert(message);  // NPE here

I'll attach a patch to KnowledgeAgentTest containing a failing test case.

Comment 1 nwallace 2009-07-07 15:29:50 UTC
Link: Added: This issue is related to JBRULES-2090


Comment 2 nwallace 2009-09-01 12:29:19 UTC
Fix in place.

Comment 3 David Le Sage 2009-09-10 05:37:38 UTC
For documenting this in the Release Notes, can you please confirm the following and fill in the missing information. Dot point explanations are fine:

The CAUSE (what was actually broken)
 * 

CONSEQUENCES of the bug (how it impacts users.)
 * The StatelessKnowledgeSessions created by the Knowledge Agent were, when used in pipelines, causing  null pointer exceptions. 

The FIX (what was changed to eliminate this bug) and 
 * The Agent is now checked to ensure that the latest version of the rulebase has been set.

RESULTS of the fix (what now happens for users.)
 * 

Comment 4 Dana Mison 2009-10-05 05:45:07 UTC
added to the 5.0.CP01 release notes as resolved:

JBRULES-2090
StatelessKnowledgeSessions created by KnowledgeAgent could throw a Null Pointer Exception if used in a pipeline. This because KnowledgeAgent creates the StatelessKnowlegeSession with a null ruleBase. The Agent is now checked to ensure that the latest version of the rule base has been set.