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

Can't use functions when MVEL dialect is set at package level

    Details

    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Put functions in a separate drl, or use mvel tag on each rule. Downside is that it is back to using java for function bodies.

      Show
      Put functions in a separate drl, or use mvel tag on each rule. Downside is that it is back to using java for function bodies.

      Description

      package jboss.cloud

      dialect "mvel"

      #trying to get functions working...
      rule "something"
      when
      s: SimpleFact(id == 42, name == "michael")
      then
      System.out.println("hello");
      end

      function String doSomething()

      { return "hey"; }

      And I get:

      java.lang.NullPointerException
      at org.drools.rule.builder.dialect.mvel.MVELDialect.compile(MVELDialect.java:510)
      at org.drools.rule.builder.dialect.mvel.MVELDialect.addFunction(MVELDialect.java:338)
      at org.drools.compiler.PackageBuilder.addFunction(PackageBuilder.java:1104)
      at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:626)
      at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
      at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
      at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mfusco Mario Fusco
                  Reporter:
                  michaelneale Michael Neale
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: