[rules-users] Re: referencing two or more classes with the same name but in different packages

ST super_thunder2 at hotmail.com
Thu Feb 14 16:50:07 EST 2008


Hi Edson,

Thank you for your reply.  I got the following error when I was trying to add
the package by calling ruleBase.addPackage( builder.getPackage() )

Below is the stack trace.

Exception in thread "main" org.drools.rule.InvalidRulePackage: Unable to resolve
ObjectType 'org.drools.examples.NumberGuessExample.RandomNumber' : [Rule
name=Get user Guess, agendaGroup=MAIN, salience=0, no-loop=true]
Unable to resolve ObjectType
'org.drools.examples.NumberGuessExample.RandomNumber' : [Rule name=No more
Guesses notification, agendaGroup=MAIN, salience=0, no-loop=false]

	at org.drools.rule.Package.checkValidity(Package.java:424)
	at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:384)
	at org.drools.examples.NumberGuessExample.main(NumberGuessExample.java:32)

I modified the NumberGuess.drl to see if the approach works.  Below is one of
the rules with the fully qualified class name.

rule "No more Guesses notification"
	ruleflow-group "No more Guesses"
	when
        r : org.drools.examples.NumberGuessExample.RandomNumber()    
	    game : Game( )        
	then	
        System.out.println( "\nYou have no more guesses\nThe correct guess was "
+ r.value );
        System.out.println( "Your smallest guess  was " + game.smallest +
"\nYour biggest guess  was " + game.biggest );
end	

Thanks,
ST




More information about the rules-users mailing list