[rules-users] Drools 6 and OSGi

Florian Pirchner florian.pirchner at gmail.com
Wed Apr 2 15:51:08 EDT 2014


Hi Mark,

could not find anybody in cc :D

Good to hear, that there is progress in the OSGi stuff.

My question is about the architecture changes to meet OSGi requirements.
There are a lot of Class#forName calls to create new instances. In OSGi it
is not that easy then in java SE. Each bundle has its own class loader. And
classes are only visible to bundles, if their package was imported.

I could see, that there is a ProjectClassLoader. And that there is a way to
provide a common parent classloader. That might be the bundle classloader.
So most of the classes can be found by Class#forName. But it requires a
bundle, that imports all the dependencies from drools, kie and jbpm. Only
in that case, the bundles are visible to the bundles class loader. So my
question is, whether that approach is the suggested way to add Drools and
JBPM to OSGi containers.

But a drawback is, that there is no real support about required
dependencies during development. Except the drools bundles will define
their imported packages very carefully. Why do you use Class#forName to
load classes? I did not get the idea behind it. Why don't you use "new" to
create new instances. Then the bundles have to define their dependencies
very carefully to become compiled.

Thanks a lot for your answers.

Best Florian





2014-03-31 18:28 GMT+02:00 Mark Proctor <mproctor at codehaus.org>:

> There was a lot of OSGi fixes in 6.0.1, aimed at the karat container.
> However not all modules are migrated, as it's a work in progress. I don't
> know which currently are or are not, I'm cc'ing in the developer behind
> this to answer.
>
> Mark
> On 31 Mar 2014, at 16:49, Florian Pirchner <florian.pirchner at gmail.com>
> wrote:
>
>  Hi,
>
> today i started to setup Drools 6 in my OSGi container. But it seems there
> are some issues that do not allow to run drools 6 (and jbpm) under OSGi
> properly.
>
> For instance:
> JPAKnowledgeService
>                 .newStatefulKnowledgeSession(kieBase, null, env);
> will never find "org.drools.persistence.jpa.KnowledgeStoreServiceImpl"
> since it is not in the scope of the current ClassLoader.
>
> Tried to tie things up, but then there would be a cyclic dependency
> between kie-internal and jbpm-persistence-jpa.
>
> I also could see, that a ProjectClassLoader was added. I found a way to
> put my current BundleClassLoader as its parent into play. This solves a lot
> of class loading issues.
>
>
> For me it seems, that Drools 6 was not designed to run in an OSGi
> container. Is there ongoing work to integrate Drools and JBPM Version 6.xinto OSGi environments properly?
>
>  --
> Thanks for your answer
> Florian Pirchner
>
>
>  _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Mit besten Grüßen
Florian Pirchner
Lunifera GmbH
Marchfelder Straße 2
2301 Groß Enzersdorf
Austria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140402/1dd40004/attachment.html 


More information about the rules-users mailing list