Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1774

Error converting "drools" variable into KnowledgeHelper class with drools-model-compiler

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 7.11.0.GA
    • BRE
    • None
    • False
    • False
    • Undefined
    • Hide

      Workaround-1: Avoid using "drools-model-compiler" 

      Workaround-2: Avoid converting "drools" variable directly into "org.drools.core.spi.KnowledgeHelper". We can update the "var_drools.drl" file with following , and convert it into "org.drools.core.definitions.rule.impl.RuleImpl" inside PrintDroolsInfo.java

      
      PrintDroolsInfo.print(drools.getRule());
      
      
      Show
      Workaround-1: Avoid using "drools-model-compiler"  Workaround-2: Avoid converting "drools" variable directly into "org.drools.core.spi.KnowledgeHelper". We can update the "var_drools.drl" file with following , and convert it into "org.drools.core.definitions.rule.impl.RuleImpl" inside PrintDroolsInfo.java PrintDroolsInfo.print(drools.getRule());
    • Hide

      1) In attached reproducer project "precompile-demo" folder, do "$ mvn clean package" and review the error output

      2) Commenting out "drools-model-compiler" dependency in project pom.xml will lead to successful build

      3) The same project can be compiled with RHDM 7.6.0 dependencies (7.30.0.Final-redhat-00003)

      Show
      1) In attached reproducer project "precompile-demo" folder, do "$ mvn clean package" and review the error output 2) Commenting out "drools-model-compiler" dependency in project pom.xml will lead to successful build 3) The same project can be compiled with RHDM 7.6.0 dependencies (7.30.0.Final-redhat-00003)
    • 2021 Week 28-30 (from Jul 12)

    Description

      When using "drools-model-compiler" to build a rule which uses "drools" built-in variable and tries to convert it into KnowledgeHelper class, following error will be reported in compilation :

      
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile-1) on project precompile-demo: Compilation failure
      [ERROR] /path/to/precompile-demo/target/generated-sources/drools-model-compiler/main/java/com/ex/demo/PF0/LambdaConsequenceF05F900892C9C0080DD3CE63F75D4E84.java:[21,35] incompatible types: org.drools.model.Drools cannot be converted to org.drools.core.spi.KnowledgeHelper
      
      

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              rhn-support-lywang Lyle Wang (Inactive)
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: