[rules-users] Error: unable to resolve method

xalperte javier.alperte at rudder-tech.com
Mon Jan 4 01:46:55 EST 2010


I'm having a problem a little odd trying to fire rules using the Guvnor.

In Guvnor I have a package named package kobo.regularSafaris, inside this
package I have defined rules (with some DSL definitions), a decision table
(xls) and two functions.

The problem is that when I'm trying to call the functions in the consequence
of a rule I'm having the following error:

org.drools.runtime.rule.ConsequenceException: [Error: unable to resolve
method:
kobo.regularSafaris.AddBookingPayment.addBookingPayment(kobo.regularSafaris.BookingRequest,
java.lang.Integer, java.lang.Integer) [arglength=3]]
[Near : {... Unknown ....}]
             ^
[Line: 1, Column: 0]
	at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
	at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
	at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:632)
	at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:187)
	at
com.rudder.packages.test.rules.PricesRulesTestCase.testNobelLowSeasonPrices(PricesRulesTestCase.java:108)

The function definition is as follows:

function void addBookingPayment(BookingRequest request, int days, int
percentage) {
     PaymentPolicy payment = new PaymentPolicy();
     payment.setPercentage(percentage);

     if( days > 0 ) {
         DateMidnight dueDate = new
DateMidnight(request.getDepartureDate().getTime()).minusDays(days); 
         payment.setType("DEFERRED"); 
         payment.setDueDate(dueDate.toDate()); 
     } else {
         payment.setType("NOW"); 
         payment.setDueDate(null);
     }

     List payments = request.getBookingData().getPayments();
     if(payments == null) {
         payments = new ArrayList();
         request.getBookingData().setPayments(payments);
     }

     payments.add(payment);
}

And the rule that is calling the function is the following:

rule "Def. Deferred Payment for Credit Operator"
	dialect "mvel"
	when
		$request: BookingRequest()
		user: User(type == "Professional") from $request.user
		eval($request.getBookingData().getPayments() == null) || ArrayList(size ==
0) from $request.bookingData.payments
		eval( "true".equals($request.getUser().getTags().get("hasCredit")))
		eval( (new
DateMidnight($request.getDepartureDate().getTime())).minusDays(35).toDate().after(new
Date()))
	then
		addBookingPayment($request, 35, 100);
end

It seems that the system is adding an extra "AddBookingPayment" to the
package name and this is causing the problem. Why is doing that? how can i
solve this?

Thanks in advance

-- 
View this message in context: http://n3.nabble.com/Error-unable-to-resolve-method-tp108194p108194.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list