Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-1397

org.mvel.CompileException: variable already defined within scope

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.3
    • Fix Version/s: 4.0.4, 5.0.0.M1
    • Component/s: None
    • Labels:
      None

      Description

      Reported by Alexander Bagerman.

      The following rule and code snippet raises the problem:

      rule "rule"
      dialect "mvel"
      when
      $p : Person( $likes : likes )
      then
      Cheese c = new Cheese( $likes );
      System.out.println( $p + " -> " + c );
      insert( c );
      end

      // snippet
      Person bob = new Person( "Bob", "stilton" );
      Person mark = new Person( "Mark", "brie" );
      workingMemory.insert( bob );
      workingMemory.insert( mark );
      workingMemory.fireAllRules();

      The exception is:

      Caused by: org.mvel.CompileException: variable already defined within scope: class com.sample.Cheese c
      at org.drools.base.mvel.DroolsMVELFactory.createVariable(DroolsMVELFactory.java:218)
      at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
      at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
      at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
      at org.mvel.MVEL.executeExpression(MVEL.java:235)
      at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
      at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  tirelli Edson Tirelli
                  Reporter:
                  tirelli Edson Tirelli
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: