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

Drools cannot resolve functions when argument is a fact type

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      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

            Assignee:
            mfusco Mario Fusco
            Reporter:
            nedoo Nedo Nedic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: