Hello.

According to your advices I've done some tests with the Drools 6.1.0 fetaures, and it seems to work but with some problems.

I've installed the feature as follow to start what seems to be the minimal needed package to make my application code work :
features:addurl mvn:org.drools/drools-karaf-features/6.1.0.Beta3/xml/features
features:install drools-common
features:install drools-module
features:install kie

My code is very simple, it uses the KIE AI with no special classloader mentions for example, and my rules files (kmodule.xml and drl files) are found as expected in the jar that loads them (in a first time I've not tried to separate rules from code).

I've found a problem when updating my bundle that contains the rules, with the following exception.

<pre>
08:30:25,366 | ERROR | rint Extender: 3 | BlueprintContainerImpl           | 10 - org.apache.aries.blueprint - 0.3.2 | Unable to start blueprint container for bundle test-drools-osgi-expert-kie
org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instanciating bean expert of class class my.tests.drools.osgi.expert.kie.KieExpert
        at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:271)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:708)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:337)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230)[10:org.apache.aries.blueprint:0.3.2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_51]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_51]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_51]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_51]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_51]
        at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]
Caused by: java.lang.IllegalStateException: There's already another KieContainer created from a different ClassLoader
        at org.drools.compiler.kie.builder.impl.KieServicesImpl.getKieClasspathContainer(KieServicesImpl.java:74)
        at my.tests.drools.osgi.expert.kie.KieExpert.&lt;init&gt;(KieExpert.java:24)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.7.0_51]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)[:1.7.0_51]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.7.0_51]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)[:1.7.0_51]
        at org.apache.aries.blueprint.utils.ReflectionUtils.newInstance(ReflectionUtils.java:257)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BeanRecipe.newInstance(BeanRecipe.java:842)[10:org.apache.aries.blueprint:0.3.2]
        at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:269)[10:org.apache.aries.blueprint:0.3.2]
        ... 14 more
</pre>

Some idea about that ? I interpret that rules are managed by Drools in a repository that rebembers the origin classloader, and that doesn't refresh itsef when the rules source bundles are updated. Is it a bug ?

I found that stopping all the feature bundles abnd restarting them seem to reload the rules, but sometimes with a large flow of errors in the console (I have no copy of that)...

Could you please confirm I'm on the right way ?

Another question is about the best way to deploy the Drools features when the production system has no internet access, which is our case. Is there any prepackaged feature that can be deployed on the local system to avoid external maven acesses ?

Thanks a lot.

Regards.

        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Deploy-Rules-in-separate-OSGi-bundles-tp4029541p4029592.html">Re: [rules-users] Deploy Rules in separate OSGi bundles</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>