<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Hi guys,<br>&nbsp; &nbsp; I have a question regarding the import function feature in Drools 5.1.0M. <br><br>&nbsp; &nbsp; I am reading the Drools <span class="yshortcuts" id="lw_1257218127_0">JBoss</span>
Rules 5.0 book Developer's guide by Michal Bali and tried one of the
examples but somehow I couldn't get my rules work with the method that
has varargs. <br><br>Here's what I have (copied from page 123):<br><br>public class ValidationHelper {<br>&nbsp; &nbsp; public static void error (RuleContext kcontext, Object... context) {<br>&nbsp; &nbsp; &nbsp; &nbsp; KnowledgeRuntime knowledgeRuntime = kcontext.getKnowledgeRuntime();<br>&nbsp; &nbsp; &nbsp; &nbsp; ValidationReport validationReport = (ValidationReport)knowledgeRuntime.getGlobal("validationReport");<br>&nbsp; &nbsp; &nbsp; &nbsp; ReportFactory reportFactory = (ReportFactory) knowledgeRuntime.getGlobal("reportFactory");<br><br>&nbsp; &nbsp; &nbsp; &nbsp; kcontext.insertLogical(reportFactory.createMessage(<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Message.Type.ERROR, kcontext.getRule().getName(),<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context));<br>&nbsp; &nbsp; }<br>}<br><br><br>then in my drools file (copied from page 42): <br>i have<br><br>import org.drools.runtime.rule.RuleContext;<br>import
 function ValidationHelper.error;<br>...<br>rule test<br>when<br>&nbsp;  #condition<br> then<br>&nbsp; &nbsp; error(drools)<br><br><br>but when I ran the test, I got error message:<br><br>Exception
in thread "main" org.drools.runtime.rule.ConsequenceException: [Error:
unable to resolve method:
ValidationHelper.error(org.drools.base.DefaultKnowledgeHelper)
[arglength=1]]<br><br>If I remove the parameter Object... context, then
everything worked. But I do need the varargs here because I need my
error message to be more specific.<br><br>Did anyone else encounter the same problems?<br><br><br>thanks!</div><br>

      </body></html>