[rules-users] Deploy Drools in AS7 as OSGi bundles

Mark Proctor mproctor at codehaus.org
Tue Oct 2 00:38:13 EDT 2012


Our OSGi stuff is best effort - working on OSGi was like sticking needles directly into the back of my eyeball, not fun. tbh I find OSGi a real PITA. Too many of our dependencies do not have real OSGi bundles available, so we have to resort to the spring repository - where the versions almost never match our original target version. Further when it fails it's almost freaking impossible to determine why it fails.

We use the spring test module, we provide it all the dependencies that you see, and run the tests. Other than suggesting to look at the spring OSGi test executions, I can't really offer more help. But it will nearly always boil down to wrong jars or wrong versions of jars - figuring out which of those are the problem, is not easy. Either it works, of it doesn't. If it doesn't,  there is no simple way to debug why OSGi doesn't work. Generally I have to take it back to the last version that worked and keep incrementally changing it until I find out specifically doesn't work, so I can address it.

You might find it useful to look at the bundle context that spring osgi creates, here is all the bundles and their versions necessary for the unit tests to run:
https://github.com/droolsjbpm/droolsjbpm-build-distribution/blob/master/drools-osgi-bundles/org.drools.osgi.test/src/test/filtered-resources/boot-bundles.properties

good luck :) Please document any helpers you find, and submit as pull requests.


Mark


On 1 Oct 2012, at 21:26, Dan Seaver <dan.seaver at ge.com> wrote:

> Thanks Mark, but I still am having issues.
> I cloned the latest droolsjbpm-build-distribution and built
> drools-osgi-bundles and reviewed the documentation you refenced. I don't see
> it stated anywhere, but I assume I need to install and start all of the jars
> in drools-osgi-bundles-distribution-5.5.0-SNAPSHOT.zip. 
> 
> So, I put all of those jars in the AS7's Standalone deployments folder and
> started up AS7. The only jar that seemed to have trouble is
> *com.springsource.antlr-2.7.6.jar* because of an *IllegalArgumentException:
> A fragment is not a module*. 
> 
> Now I tried to deploy the *knowledge-api-5.5.0-SNAPSHOT.jar*, and I get an
> error with *com.springsource.com.sun.tools.xjc:2.1.7* (see stacktrace
> below), which prohibits me from installing and starting any of the other
> drools bundles mentioned in the doc. 
> 
> Any thoughts about what's amiss?
> 
> Stack Trace:
> ==========
> 10:10:44,609 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
> (MSC service thread 1-8) Framework ERROR:
> org.osgi.framework.BundleException: Cannot resolve bundle resModule:
> [org.drools.api:5.5.0.SNAPSHOT]
>        at
> org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:157)
> [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
>        at
> org.jboss.osgi.framework.internal.AbstractBundleState.ensureResolved(AbstractBundleState.java:551)
> [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
>        at
> org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:211)
> [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
>        at
> org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:494)
> [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
>        at
> org.jboss.as.osgi.deployment.BundleStartTracker$1.processService(BundleStartTracker.java:144)
> [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
>        at
> org.jboss.as.osgi.deployment.BundleStartTracker$1.transition(BundleStartTracker.java:119)
> [jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
>        at
> org.jboss.msc.service.ServiceControllerImpl.invokeListener(ServiceControllerImpl.java:1416)
> [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
>        at
> org.jboss.msc.service.ServiceControllerImpl.access$2700(ServiceControllerImpl.java:49)
> [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
>        at
> org.jboss.msc.service.ServiceControllerImpl$ListenerTask.run(ServiceControllerImpl.java:1954)
> [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> [rt.jar:1.6.0_26]
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> [rt.jar:1.6.0_26]
>        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
> Caused by: org.jboss.osgi.resolver.XResolverException: Constraint violation
> for package 'org.relaxng.datatype' when resolving module
> Module[com.springsource.com.sun.tools.xjc:2.1.7] between existing export
> Module[com.springsource.com.sun.tools.xjc:2.1.7].org.relaxng.datatype NO
> BLAME and uses constraint
> Module[com.springsource.org.relaxng.datatype:1.0.0].org.relaxng.datatype
> BLAMED ON [[Module[com.springsource.com.sun.tools.xjc:2.1.7]] package;
> (&(package=com.sun.msv.datatype.xsd.ngimpl)(version>=0.0.0.20060615)(version<=0.0.0.20060615)),
> [Module[com.springsource.com.sun.msv.datatype:0.0.0.20060615]] package;
> (&(package=org.relaxng.datatype)(version>=1.0.0)(!(version>=2.0.0)))]
>        at
> org.jboss.osgi.resolver.felix.FelixResolver.resolveInternal(FelixResolver.java:117)
> [jbosgi-resolver-felix-1.0.13.Final.jar:1.0.13.Final]
>        at
> org.jboss.osgi.resolver.spi.AbstractResolver.resolve(AbstractResolver.java:149)
> [jbosgi-resolver-spi-1.0.13.Final.jar:1.0.13.Final]
>        at
> org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:155)
> [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
>        ... 11 more
> 
> 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Deploy-Drools-in-AS7-as-OSGi-bundles-tp4020052p4020066.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list