Mario,
Do you know whether the new method Charles added:
ks.newKieClasspathContainer(getClass().getClassLoader());
will get merged into the 6.0.x release? I cannot seem to make incremental
rule building work in OSGi without it. For instance, even when I run (in
Apache Karaf) the example project Charles made (referenced below), when I
call:
ks.newKieContainer(APP_REL_ID).getKieBase();
it fails with:
java.lang.IllegalArgumentException:
conflict Resolver 'org.drools.core.conflict.DepthConflictResolver' not
found
probably because I'm not initializing the KieClasspathContainer with the
classloader from my class.
Thanks!
Joseph
Charles Moulliard-2 wrote
My example uses this META-INF/kmodules.xml file to let the
KieContainer
to scan and discover the resources (.drl, pacjkages) when we call
KieContainer kcont =
ks.newKieClasspathContainer(getClass().getClassLoader());
KieBase kbase = kcont.getKieBase("sampleKBase");
As you have mentioned in your email, this is a static approach as we
load the resources before to create a KieSession and fire the rules.
To be able to do increment, the approach that you mention is the way
to go. I have also created an example where the KieModule is created
using a programming approach -->
*https://github.com/cmoulliard/droolsjbpm-osgi-examples/blob/master/simple-external-resource/src/main/java/org/drools/example/osgi/FetchExternalResourceOsgiActivator.java
<https://github.com/cmoulliard/droolsjbpm-osgi-examples/blob/master/simple-external-resource/src/main/java/org/drools/example/osgi/FetchExternalResourceOsgiActivator.java>.
That should not be difficult to adapt it to support increment*
3. It looks like I'll have to wait until Drools 6.1.0 to get the
parameter
to specify a classloader when creating the container? I see you just
added
that recently. I've tried using
Thread.currentThread().setContextClassLoader(...) but can't seem to make
that work with Drools 6.0.1 in Karaf 2.3.3 because then
RuleBaseConfiguration sets the classloader and uses it to try resolving
org.drools.core.conflict.DepthConflictResolver, which it can't do because
it's no longer using the OSGi classloader.
I have no ideas if my modifications will be merged with 6.0.x release.
Mario Fusco should be able to provide a response
--
View this message in context:
http://drools.46999.n3.nabble.com/kContainer-newKieSession-fails-in-Apach...
Sent from the Drools: User forum mailing list archive at
Nabble.com.