Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6936

BigDecimalLiteral with binding in mvel dialect causes ClassCastException in executable model build

XMLWordPrintable

    • 2022 Week 17-19 (from Apr 25)
    • 2
    • Hide

      run attached reproducer (kjar project) by mvn clean install.

      Show
      run attached reproducer (kjar project) by mvn clean install.
    • Hide

      do not use BigDelinal Literal

      e.g. modify below constranit

      $fact : Fact( $bd: bd, $zero: 0B )

      to :

      $fact : Fact( $bd: bd, $zero: 0 )

      Show
      do not use BigDelinal Literal e.g. modify below constranit $fact : Fact( $bd: bd, $zero: 0B ) to : $fact : Fact( $bd: bd, $zero: 0 )
    • NEW
    • NEW
    • ---
    • ---

      When BigDecimal literal is set to variable with mvel dialect
      ~~~
      dialect "mvel"

      rule "rule_set_BD_literal"
      no-loop true
      when
      $fact : Fact( $bd: bd, $zero: 0B )
      // $fact : Fact( $bd: bd, $zero: 0 ) /* this works*/
      then
      System.out.println("*****["+kcontext.getRule().getName()+"] $fact = "+$fact);
      end
      ~~~
      When building the executable model

      Results in the following exception (stacktrace)

      [ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.59.0.Final-redhat-00009:generateModel (default-generateModel) on project reproducer_bigdecimal_literal: A type incompatibility occurred while executing org.kie:kie-maven-plugin:7.59.0.Final-redhat-00009:generateModel: null
      [ERROR] -----------------------------------------------------
      [ERROR] realm =    extension>org.kie:kie-maven-plugin:7.59.0.Final-redhat-00009
      [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
      [ERROR] urls[0] = file:/home/jboss/.m2/repository/org/kie/kie-maven-plugin/7.59.0.Final-redhat-00009/kie-maven-plugin-7.59.0.Final-redhat-00009.jar
      [ERROR] urls[1] = file:/home/jboss/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22.redhat-00001/plexus-utils-3.0.22.redhat-00001.jar
      [ERROR] urls[2] = file:/home/jboss/.m2/repository/org/apache/commons/commons-lang3/3.11.0.redhat-00001/commons-lang3-3.11.0.redhat-00001.jar
      [ERROR] urls[3] = file:/home/jboss/.m2/repository/org/apache/maven/shared/maven-artifact-transfer/0.9.1/maven-artifact-transfer-0.9.1.jar
      [ERROR] urls[4] = file:/home/jboss/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
      [ERROR] urls[5] = file:/home/jboss/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
      [ERROR] urls[6] = file:/home/jboss/.m2/repository/commons-codec/commons-codec/1.15.0.redhat-00001/commons-codec-1.15.0.redhat-00001.jar
      [ERROR] urls[7] = file:/home/jboss/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
      [ERROR] urls[8] = file:/home/jboss/.m2/repository/commons-io/commons-io/2.7.0.redhat-00003/commons-io-2.7.0.redhat-00003.jar
      [ERROR] urls[9] = file:/home/jboss/.m2/repository/org/apache/maven/maven-builder-support/3.3.9.redhat-2/maven-builder-support-3.3.9.redhat-2.jar
      [ERROR] urls[10] = file:/home/jboss/.m2/repository/com/google/guava/guava/30.1.0.jre-redhat-00003/guava-30.1.0.jre-redhat-00003.jar
        [...]
      [ERROR] urls[110] = file:/home/jboss/.m2/repository/org/antlr/antlr4-runtime/4.8.0.redhat-00002/antlr4-runtime-4.8.0.redhat-00002.jar
      [ERROR] urls[111] = file:/home/jboss/.m2/repository/org/kie/kie-dmn-validation/7.59.0.Final-redhat-00009/kie-dmn-validation-7.59.0.Final-redhat-00009.jar
      [ERROR] urls[112] = file:/home/jboss/.m2/repository/org/kie/kie-dmn-api/7.59.0.Final-redhat-00009/kie-dmn-api-7.59.0.Final-redhat-00009.jar
      [ERROR] urls[113] = file:/home/jboss/.m2/repository/org/apache/commons/commons-compress/1.19.0.redhat-00001/commons-compress-1.19.0.redhat-00001.jar
      [ERROR] urls[114] = file:/home/jboss/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
      [ERROR] Number of foreign imports: 1
      [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
      [ERROR] 
      [ERROR] -----------------------------------------------------
      [ERROR] : ClassCastException: class com.github.javaparser.ast.visitor.CloneVisitor cannot be cast to class org.drools.mvel.parser.ast.visitor.DrlGenericVisitor (com.github.javaparser.ast.visitor.CloneVisitor and org.drools.mvel.parser.ast.visitor.DrlGenericVisitor are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @3e7b65d7)
      
      

              rhn-support-tkobayas Toshiya Kobayashi
              rhn-support-tkobayas Toshiya Kobayashi
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: