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

Drools cannot resolve functions when argument is a fact type

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 5.5.0.Beta1
    • 5.3.0.Final
    • drools-compiler
    • None
    • Hide

      I can reproduce this error using Guvnor 5.3.0 Distribution.

      1. Create new model and fact type (ex. Nagios)
      2. Create new function:

      function String NagiosDataFormatter(Nagios nn) {

      String formattedMsg = "";

      formattedMsg += "\n IP: " + nn.getIp_address();
      formattedMsg += "\n Host: " + nn.getHost_alias();

      return formattedMsg;
      }

      3. Create simple rule, so the function is invoked in the consequence:

      1. | rule "NagiosFormatterRuleTest"
      2. | dialect "mvel"
      3. | when
      4. | na:Nagios()
      5. | then
      6. | NagiosDataFormatter(na)
      7. | end

      4. Validate the rule. Then the following error is thrown:

      ( 17:52:34,782 ERROR [STDERR] Caused by: [Error: unable to resolve method using strict-mode: CorrelatorSep.NagiosDataFormatter.NagiosDataFormatter(CorrelatorSep.Nagios)]
      [Near :

      {... NagiosDataFormatter(na); ....}

      ]
      : )

      Show
      I can reproduce this error using Guvnor 5.3.0 Distribution. 1. Create new model and fact type (ex. Nagios) 2. Create new function: function String NagiosDataFormatter(Nagios nn) { String formattedMsg = ""; formattedMsg += "\n IP: " + nn.getIp_address(); formattedMsg += "\n Host: " + nn.getHost_alias(); return formattedMsg; } 3. Create simple rule, so the function is invoked in the consequence: 1. | rule "NagiosFormatterRuleTest" 2. | dialect "mvel" 3. | when 4. | na:Nagios() 5. | then 6. | NagiosDataFormatter(na) 7. | end 4. Validate the rule. Then the following error is thrown: ( 17:52:34,782 ERROR [STDERR] Caused by: [Error: unable to resolve method using strict-mode: CorrelatorSep.NagiosDataFormatter.NagiosDataFormatter(CorrelatorSep.Nagios)] [Near : {... NagiosDataFormatter(na); ....} ] : )

    Description

      Note that this only fails when MVEL dialect is used with functions using non-primitive argument types (for an instance using
      fact types arguments).
      This error appeared when we migrated from Drools 5.0.1.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            nedoo Nedo Nedic (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty