dialect java is not loading the facts in Drools
by santhosh kumar
Hi,
Can some one help in resolving the below issue or if there is any work
around for this?
There is a strange behaviour in terms of loading the facts using dialect
java and mvel.
Our requirement is that we should support dynamic changes to fact objects in
the application without a restart. So, to achieve that I am using jar
classloader to load the fact objects into memory. So before constructing
RuleBase I am switching the current class loader context to jar classloader.
By doing this, all the imported facts getting resolved if I use mvel dialect
where as if I use java dialect it's not able to resolve the fact. Can
someone help on how to resolve this issue.
I can't use mvel dialect as it's behaving strangely in case of accumulate.
So I need to use java dialect only.
Please let me know why java dialect is considering the facts only from
classpath. It's not loading from current classloader's context
Below is the code to switch classloader context
Thread.currentThread().setContextClassLoader(
jarClassLoader);
InputStream is = //reads from jar content
RuleBase ruleBase = RuleBaseLoader.getInstance().loadFromReader(
new InputStreamReader(is));
StatelessSession statelessSession = ruleBase.newStatelessSession();
statelessSession.executeWithResults(facts);
Thanks
Santhosh
13 years, 4 months