Ok, you got me hooked by my curiosity now. :)
I know Drools internals, but I unfortunately know nothing about Eclipse
internals (maybe I can learn something today). So, we will need to work
together on this, ok?
First things first, can you please update to M3? Besides possible bug
fixes, it way will be easier to debug things since line numbers will match.
Drools works AFAIK pretty well in App Servers. Yes, it creates custom
classloaders internally because it needs to generate classes, but it does
respect classloader hierarchy as much as I know it is possible.
The two ways to tell Drools about facts being in a different classloader
* Either set the fact classloaders explicitly on *both*
PackageBuilderConfiguration and RuleBaseConfiguration for compile-time and
runtime respectivelly. This is my preferred approach.
* Or, if a classloader is not set in the configuration objects, Drools will
look for the ThreadContext set classloader.
The above covers the use cases for JEE containers and I am not aware of
Now, how Eclipse differs from that? What does it means to set a plugin as
"buddy" of another? Sorry if the question is too basic, but never played
with Eclipse plugins before.
2008/12/3 keithnielsen <keithnielsen(a)discover.com>
Since my last post was so nicely hijacked I have started a new thread in
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"
boolean cidResult =
CIDResult result = new CIDResult(cidResult);
System.out.println("Executing: Retrieve CID Presentation
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
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
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:
Sent from the drools - user mailing list archive at Nabble.com
rules-users mailing list
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com