[jboss-jira] [JBoss JIRA] Issue Comment Edited: (JBRULES-2734) NPE loading changeset

Anton Litvinenko (JIRA) jira-events at lists.jboss.org
Tue May 17 14:12:01 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-2734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602652#comment-12602652 ] 

Anton Litvinenko edited comment on JBRULES-2734 at 5/17/11 2:11 PM:
--------------------------------------------------------------------

@Esteban, for me it is failing when a rule is present in the package (compiled and distributed by Guvnor). The change set pointed to that package and ruleflow is not even using it. I change the ruleflow (not even touching the rule), commit it to Guvnor, re-build the package and see change-set update crash in the log.

change-set:
{code:xml}
<change-set xmlns='http://drools.org/drools-5.0/change-set'
            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
            xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd'>
    <add>
        <resource source='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'
                  type='PKG' basicAuthentication='enabled' username='' password=''/>
    </add>
</change-set>

{code}

Rule:
{code:xml}
#created on: Apr 7, 2011
package my.package;
 
import java.util.Map;
 
rule "HelloWorldRule"
	when
		params : Map()
		eval( params.get("Greeting") == null )
	then
		params.put("Greeting", "Hello World!" );
		update( params );
end
{code}

And the stack trace:
{code}
[2011:05:137 14:05:167:debug] ResourceChangeScanner thread is waiting for 30 seconds.
[2011:05:137 14:05:166:debug] ResourceChangeScanner attempt to scan 1 resources
[2011:05:137 14:05:173:debug] ResourceChangeScanner modified resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] : 1305640544000 : 1305640889000
[2011:05:137 14:05:173:debug] ResourceChangeNotification received ChangeSet notification
[2011:05:137 14:05:173:debug] ResourceChangeScanner thread is waiting for 30 seconds.
[2011:05:137 14:05:173:debug] ResourceChangeNotification processing ChangeSet
[2011:05:137 14:05:174:debug] ResourceChangeNotification ChangeSet modified resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] for listener=org.drools.agent.impl.KnowledgeAgentImpl at 602fe64a
[2011:05:137 14:05:174:debug] KnowledgeAgent received ChangeSet changed notification
[2011:05:137 14:05:175:debug] ResourceChangeNotification thread is waiting for queue update
[2011:05:137 14:05:175:info] KnowledgeAgent applying ChangeSet
[2011:05:137 14:05:175:debug] KnowledgeAgent removing mappings for resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] with unsubscribe=true
[2011:05:137 14:05:176:debug] KnowledgeAgent notifier unsubscribing to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeNotification unsubscribing listener=org.drools.agent.impl.KnowledgeAgentImpl at 602fe64a to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeScanner unsubcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl at 68b8359b to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeScanner resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] now has no subscribers
[2011:05:137 14:05:176:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2011:05:137 14:05:176:info] KnowledgeAgent performing an incremental build of the ChangeSet
[2011:05:137 14:05:229:debug] KnowledgeAgent: Diffing: [UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
no visitor implementation for : class org.drools.ruleflow.core.RuleFlowProcess : org.drools.ruleflow.core.RuleFlowProcess at 30138b
[2011:05:137 14:05:234:debug] BinaryResourceDiffProducerImpl: Comparing [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false] against [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false]
Exception in thread "Thread-17" org.drools.RuntimeDroolsException: java.lang.reflect.InvocationTargetException : [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false]
	at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
	at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)
	at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
	at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
	... 6 more
Caused by: java.lang.NullPointerException
	at org.drools.rule.EvalCondition.equals(EvalCondition.java:169)
	at org.drools.rule.GroupElement.equals(GroupElement.java:273)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
	... 11 more
[2011:05:137 14:05:172:debug] ResourceChangeScanner attempt to scan 0 resources
[2011:05:137 14:05:172:debug] ResourceChangeScanner thread is waiting for 30 seconds.
{code}

Whenever I delete rule from package -> I dont see this error anymore


      was (Author: anton.litvinenko):
    @Esteban, for me it is failing when a rule is present in the package (compiled and distributed by Guvnor). The change set pointed to that package and ruleflow is not even using it.

change-set:
{code:xml}
<change-set xmlns='http://drools.org/drools-5.0/change-set'
            xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
            xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd'>
    <add>
        <resource source='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'
                  type='PKG' basicAuthentication='enabled' username='' password=''/>
    </add>
</change-set>

{code}

Rule:
{code:xml}
#created on: Apr 7, 2011
package my.package;
 
import java.util.Map;
 
rule "HelloWorldRule"
	when
		params : Map()
		eval( params.get("Greeting") == null )
	then
		params.put("Greeting", "Hello World!" );
		update( params );
end
{code}

And the stack trace:
{code}
[2011:05:137 14:05:167:debug] ResourceChangeScanner thread is waiting for 30 seconds.
[2011:05:137 14:05:166:debug] ResourceChangeScanner attempt to scan 1 resources
[2011:05:137 14:05:173:debug] ResourceChangeScanner modified resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] : 1305640544000 : 1305640889000
[2011:05:137 14:05:173:debug] ResourceChangeNotification received ChangeSet notification
[2011:05:137 14:05:173:debug] ResourceChangeScanner thread is waiting for 30 seconds.
[2011:05:137 14:05:173:debug] ResourceChangeNotification processing ChangeSet
[2011:05:137 14:05:174:debug] ResourceChangeNotification ChangeSet modified resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] for listener=org.drools.agent.impl.KnowledgeAgentImpl at 602fe64a
[2011:05:137 14:05:174:debug] KnowledgeAgent received ChangeSet changed notification
[2011:05:137 14:05:175:debug] ResourceChangeNotification thread is waiting for queue update
[2011:05:137 14:05:175:info] KnowledgeAgent applying ChangeSet
[2011:05:137 14:05:175:debug] KnowledgeAgent removing mappings for resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] with unsubscribe=true
[2011:05:137 14:05:176:debug] KnowledgeAgent notifier unsubscribing to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeNotification unsubscribing listener=org.drools.agent.impl.KnowledgeAgentImpl at 602fe64a to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeScanner unsubcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl at 68b8359b to resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
[2011:05:137 14:05:176:debug] ResourceChangeScanner resource=[UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST'] now has no subscribers
[2011:05:137 14:05:176:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
[2011:05:137 14:05:176:info] KnowledgeAgent performing an incremental build of the ChangeSet
[2011:05:137 14:05:229:debug] KnowledgeAgent: Diffing: [UrlResource path='http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/my.package/LATEST']
no visitor implementation for : class org.drools.ruleflow.core.RuleFlowProcess : org.drools.ruleflow.core.RuleFlowProcess at 30138b
[2011:05:137 14:05:234:debug] BinaryResourceDiffProducerImpl: Comparing [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false] against [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false]
Exception in thread "Thread-17" org.drools.RuntimeDroolsException: java.lang.reflect.InvocationTargetException : [Rule name=HelloWorldRule, agendaGroup=MAIN, salience=0, no-loop=false]
	at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
	at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)
	at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
	at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
	at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)
	at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
	... 6 more
Caused by: java.lang.NullPointerException
	at org.drools.rule.EvalCondition.equals(EvalCondition.java:169)
	at org.drools.rule.GroupElement.equals(GroupElement.java:273)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
	at org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
	... 11 more
[2011:05:137 14:05:172:debug] ResourceChangeScanner attempt to scan 0 resources
[2011:05:137 14:05:172:debug] ResourceChangeScanner thread is waiting for 30 seconds.
{code}

Whenever I delete rule from package -> I dont see this error anymore

  
> NPE loading changeset
> ---------------------
>
>                 Key: JBRULES-2734
>                 URL: https://issues.jboss.org/browse/JBRULES-2734
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-core  (expert)
>    Affects Versions: 5.1.1.FINAL
>            Reporter: Tommy Odom
>            Assignee: Esteban Aliverti
>             Fix For: 5.2.0.CR1
>
>
> We are receiving a NPE when drools is attempting to load the deltas from guvnor in our webapp.  This used to work fine in 5.0 but we recently upgraded to 5.1 and started receiving this error after we create a new snapshot in guvnor.
> The output from our application server log is:
> KnowledgeAgent applying ChangeSet
> KnowledgeAgent performing an incremental build of the ChangeSet
> no visitor implementation for : class org.drools.ruleflow.core.RuleFlowProcess : org.drools.ruleflow.core.RuleFlowProcess at 30012e
> Exception in thread "Thread-36" 
> org.drools.RuntimeDroolsException: java.lang.reflect.InvocationTargetException : [R
> ule name=Project Part Custom Finishing Cost, agendaGroup=MAIN, salience=0, no-loop=false]        at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:56)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.diff(BinaryResourceDiffProducerImpl.java:63)
>         at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:785)        at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:586)
>         at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:185)
>         at org.drools.agent.impl.KnowledgeAgentImpl$ChangeSetNotificationDetector.run(KnowledgeAgentImpl.java:1106)        at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)        at org.drools.core.util.ReflectiveVisitor.visit(ReflectiveVisitor.java:47)
>         ... 6 more
> Caused by: java.lang.NullPointerException        at org.drools.rule.EvalCondition.equals(EvalCondition.java:169)
>         at org.drools.rule.GroupElement.equals(GroupElement.java:273)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.compareRules(BinaryResourceDiffProducerImpl.java:258)
>         at org.drools.agent.impl.BinaryResourceDiffProducerImpl.visitRule(BinaryResourceDiffProducerImpl.java:117)
>         ... 11 more
> The rule that it mentions in the error is:
> dialect "java"
> ruleflow-group "finishing-price"
> when
>   $pp : ProjectPart(finishTime > 0)
>   eval(salesChannelId != 4 && includeFinishing)
> then
>   double finishingRate = 1;
>   double customFinishingCost = $pp.getQuantity() * $pp.getFinishTime() * finishingRate;
>   addToProjectFinishingCost($pp.getProject(), customFinishingCost);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list