Hi Joseph,

I propose that you have a look to this example which is currently working on Karaf - https://github.com/cmoulliard/droolsjbpm-osgi-examples (simple = OSGI BundleActivator + KieSession + Drools Rules)

Regards,

Charles 


On Thu, Jan 23, 2014 at 4:58 PM, jhusby <husby024@umn.edu> wrote:
I wasn't subscribed to the mailing list so I don't think my message below
went through.  Apologies if it did.


jhusby wrote
> I'm trying to run Drools in an OSGi container (Apache Karaf 2.3.3 to be
> precise).  When I try to call newKieSession() on a KieContainer, I get an
> exception as follows:
>
> java.lang.IllegalArgumentException: conflict Resolver
> 'org.drools.core.conflict.DepthConflictResolver' not found
>       at
> org.drools.core.RuleBaseConfiguration.determineConflictResolver(RuleBaseConfiguration.java:868)[276:org.drools.core:6.0.1.20131220-0333]
>       at
> org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:459)[276:org.drools.core:6.0.1.20131220-0333]
>       at
> org.drools.core.RuleBaseConfiguration.init(RuleBaseConfiguration.java:415)[276:org.drools.core:6.0.1.20131220-0333]
>       at org.drools.core.RuleBaseConfiguration.
> <init>
> (RuleBaseConfiguration.java:402)[276:org.drools.core:6.0.1.20131220-0333]
>       at
> org.drools.core.impl.KnowledgeBaseFactoryServiceImpl.newKnowledgeBaseConfiguration(KnowledgeBaseFactoryServiceImpl.java:37)[276:org.drools.core:6.0.1.20131220-0333]
>       at
> org.kie.internal.KnowledgeBaseFactory.newKnowledgeBaseConfiguration(KnowledgeBaseFactory.java:125)[275:org.kie.internalapi:6.0.1.20131220-0322]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.getKnowledgeBaseConfiguration(KieContainerImpl.java:323)[277:org.drools.compiler:6.0.1.20131220-0333]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.createKieBase(KieContainerImpl.java:316)[277:org.drools.compiler:6.0.1.20131220-0333]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:257)[277:org.drools.compiler:6.0.1.20131220-0333]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:400)[277:org.drools.compiler:6.0.1.20131220-0333]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:349)[277:org.drools.compiler:6.0.1.20131220-0333]
>       at
> org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:331)[277:org.drools.compiler:6.0.1.20131220-0333]
>
> As a workaround, I was able to get it working by doing this:
>
>       KieBaseConfiguration kbaseConf = KnowledgeBaseFactory
>                                               .newKnowledgeBaseConfiguration(
>                                                       null,
>                                                       getClass().getClassLoader(),
>                                                       RuleBaseConfiguration.class.getClassLoader()
>                                               );
>       KieBase kbase = kContainer.newKieBase(kbaseConf);
>       kSession = kbase.newKieSession();
>
> but this is obviously less than ideal.  Any ideas on how to make this work
> better in OSGi?
>
> Thank you!
>
> Joseph





--
View this message in context: http://drools.46999.n3.nabble.com/kContainer-newKieSession-fails-in-Apache-Karaf-tp4027815p4027832.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io