3 Replies Latest reply on May 23, 2011 12:27 PM by Kurt Stam

    Error in DRL created from Guvnor

    Vikash Agrawal Newbie

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