[rules-users] Embedding Drools in Eclipse

keithnielsen keithnielsen at discover.com
Wed Dec 3 09:53:23 EST 2008


Since my last post was so nicely hijacked I have started a new thread in the
hopes that the Drools team can shed some light on this.

My setup is as follows:

1) 2 plug-ins, one containing the drools libraries, and a second plugin
containing the facts and the rule file.
2) The rules engine plugin has a buddy-policy of "registered" and the facts
plugin has the rules engine plugin as a registered buddy.


Here is the rule(although any fact that has field assignments fails)

rule "Retrieve CID Presentation Model" 
        ruleflow-group "RetrieveCID" 
        
        when 
               
CIDPresentationModel($cidValue:cidValue,$cidExpirationDate:expirationDate)        
        then 
                boolean cidResult =
cidService.verifyCIDIsValid($cidValue,$cidExpirationDate); 
                CIDResult result = new CIDResult(cidResult); 
                insert(result); 
                System.out.println("Executing: Retrieve CID Presentation
Model"); 
end 

Deep in the bowels of drools there is a call to
ClassFieldAccessorFactory.getClassFieldReader where it attempts to create a
class using the byte array classloader, i.e. final Class<?> newClass =
byteArrayClassLoader.defineClass(className, bytes,PROTECTION_DOMAIN). Its at
this point that a NoClassDefFoundError on the BaseObjectClassFieldReader. I
am a little concerned when I see what appears to be a custom classloader
since if you are going to embed the rules engine it should respect the
classloader hierachy from the container, whether that be an app server like
Websphere or client side container like Eclipse.

I am wondering if the team has had success with this particular setup (the
examples for Drools work cause they are all in the same plugin). I have made
the example as simple as possible but still no luck. Seems like this is
pretty basic functionality so I can't imagine this hasn't been tested.
-- 
View this message in context: http://www.nabble.com/Embedding-Drools-in-Eclipse-tp20814423p20814423.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list