ops4j / org.ops4j.pax.runner

Multi Framework OSGi Runner
http://team.ops4j.org/wiki/display/paxrunner/
47 stars 39 forks source link

Version 1.8 does not work with pax-url handlers [PAXRUNNER-425] #426

Closed ops4j-issues closed 11 years ago

ops4j-issues commented 11 years ago

Tom De Wolf created PAXRUNNER-425

When our build automatically used pax runner 1.8.1 through the maven-pax-plugin it no longer is able to provision urls like assembly:.. or mvn:..

It results in stracktraces like:

Auto-properties install: assembly:projectx/target/classes (org.osgi.framework.BundleException: Unable to cache bundle: assembly:../../projectx/target/classes - java.lang.IllegalStateException: Stream handler unavailable due to: null)
org.osgi.framework.BundleException: Unable to cache bundle: assembly:../../projectx/target/classes
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2703)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
    at org.apache.felix.main.AutoProcessor.processAutoProperties(AutoProcessor.java:296)
    at org.apache.felix.main.AutoProcessor.process(AutoProcessor.java:79)
    at org.apache.felix.main.Main.main(Main.java:292)
Caused by: java.lang.IllegalStateException: Stream handler unavailable due to: null
    at org.apache.felix.framework.URLHandlersStreamHandlerProxy.openConnection(URLHandlersStreamHandlerProxy.java:311)
    at java.net.URL.openConnection(URL.java:969)
    at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:150)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
    at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:878)
    at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
    at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
    at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2699)
    ... 4 more

After debugging the causing exception is a

java.lang.NoClassDefFoundError: Could not initialize class org.ops4j.pax.url.assembly.internal.Activator

It looks like it cannot find the class which is the super class of that Activator which is in pax-url-commons. The previous version of pax-url used by pax-runner had the commons stuff embedded in each handler bundle. The new pax-url version 1.5.0 no longer embeds those dependencies. And as the classpath given by pax-runner shows:

-cp, bundles/org.apache.felix.main_4.0.2.jar:bundles/org.ops4j.pax.url.assembly_1.5.0.jar:bundles/org.ops4j.pax.url.cache_1.5.0.jar:bundles/org.ops4j.pax.url.dir_1.5.0.jar:bundles/org.ops4j.pax.url.mvn_1.5.0.jar:bundles/org.ops4j.pax.url.link_1.5.0.jar:bundles/org.ops4j.pax.url.obr_1.5.0.jar:bundles/org.ops4j.pax.url.war_1.5.0.jar:bundles/org.ops4j.pax.url.wrap_1.5.0.jar:bundles/org.ops4j.pax.url.classpath_1.5.0.jar:bundles/org.ops4j.pax.url.reference_1.5.0.jar, org.apache.felix.main.Main

this commons jar of pax url is not included on the classpath. Which might explain why it does not work anymore.

Note that it is not only the pax-url-commons which was first embedded in the url handler bundles. Also other dependencies might now be missing.


Fixed in: 1.8.2 Votes: 0, Watches: 0

ops4j-issues commented 11 years ago

Dmytro Pishchukhin commented

could you provide more information how you use pax-runner and pax-plugin? I use them as well and could not reproduce your issue.

ops4j-issues commented 11 years ago

Dmytro Pishchukhin commented

as a workaround you can use a specific pax-runner version with maven-pax-plugin

ops4j-issues commented 11 years ago

Dmytro Pishchukhin commented

the version of pax-url (1.3.5) from 1.7.x used. update to pax-url 1.5.x will be later