[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-3048) Error in Rule created by Guvnor

Vikash Agrawal (JIRA) jira-events at lists.jboss.org
Wed May 25 06:29:01 EDT 2011


     [ https://issues.jboss.org/browse/JBRULES-3048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vikash Agrawal resolved JBRULES-3048.
-------------------------------------

    Resolution: Done


This is not a defect. This got fixed by setting up the global variables in Rule Working memory.

> Error in Rule created by Guvnor
> -------------------------------
>
>                 Key: JBRULES-3048
>                 URL: https://issues.jboss.org/browse/JBRULES-3048
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>            Reporter: Vikash Agrawal
>            Assignee: Mark Proctor
>
> Hello , 
>   
> Below is a rule created from Guvnor and while executing it it is giving me a issue: 
>   
> Rule Code
> ------------------------------------------- 
> package ACTIVITY_POC 
> import com.sample.Message 
> global com.sample.Message message 
>   
> rule "NewRule" 
> dialect "mvel" 
> when 
>   Message( status == "200" && messageText == "test" ) 
> then 
>   Message fact0 = new Message(); 
>   fact0.setStatus( 200 ); 
>   insert(fact0 ); 
> end 
>   
> Error:
> -------------------------------------------------------------------------- 
> org.drools.runtime.rule.ConsequenceException: rule: NewRule 
> at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:927) 
> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:856) 
> at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1071) 
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:785) 
> at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:751) 
> at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218) 
> at com.sample.ABCD.main(ABCD.java:41) 
> Caused by: [Error: unable to access property (null parent): setStatus] 
> [Near : {... Unknown ....}] 
>              ^ 
> [Line: 1, Column: 0] 
> at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:886) 
> at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:314) 
> at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:137) 
> at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:137) 
> at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85) 
> at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:104) 
> at org.mvel2.MVEL.executeExpression(MVEL.java:1001) 
> at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:103) 
> at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917) 
> ... 6 more 
>   
>   
> -------------------------------------------------------------------------------------- 
> Message Object:
> ----------------------------------------------------------------------------------- 
> package com.sample; 
> public class Message { 
>   
>   private String messageText; 
>   public String getMessageText() { 
>    return messageText; 
>   } 
>   public void setMessageText(String messageText) { 
>    this.messageText = messageText; 
>   } 
>   private int status; 
>   
>   public int getStatus() { 
>    return this.status; 
>   } 
>   public void setStatus(int status) { 
>    this.status = status; 
>   } 
>   
> }

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