Hello,

 

I am using various classes in the consequences of my rules and I would like to dynamically re-load the classes.

 

Currently, I include the following code snippet which sets the class loader:

 

KnowledgeBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(properties, MyClassLoader.getInstance());

KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);

 

However, if I change the underlying jar and inform my classloader of this change, the old class is still used in the rule consequences.

 

I therefore assume that Drools is storing a reference to the old class in the previously created KnowledgeBases so MyClassLoader.loadClass() is only invoked the first time the class is required.

 

My question is thus: Is there any way to force a class reload on a KnowledgeBase or do I have to re-create the Knowledgebase?

 

If so, would it be a case of getAllFactHandles() (or similar) and assert these into a newly created KnowledgeBase with a new instance of MyClassloader?

 

Cheerio,

Nic

 

Nicholas Hemley

Senior Developer

Sidonis | Powering a New Generation of Service Assurance