Cannot use PAX-URL's assembly protocol with auto started bundles in Felix config.properties
I'm trying to use PAX-URL so I can have non-packed bundles assembled on the fly.
If I put pax-url-assembly-1.2.1.jar in the autostart bundles, and then type
install assembly:path/to/m开发者_如何学编程y/folder
everything works. The trouble is, I want to give felix those folders in the config file using > felix.auto.start.1=assembly:path/to/my/folder
If I do so, I get an "Unknown protocol: assembly" exception.
I've tried loading PAX-URL at level 1 and set the default start level of all other bundles to 10. Won't help. I think it's the "System Bundle" itself that reads the configuration before any bundle is loaded and therefore "assembly" is not understood.
My guess is I need to tell Felix to load PAX-URL right when Felix itself starts.
Any ideas? Did I get it all wrong? :)
Thanks!
Try putting PAX-URL into bundle
folder in Apache Felix and launch it with -Djava.protocol.handler.pkgs=org.ops4j.pax.url
options.
Here is a post describing Apache Felix development in Eclipse
One more thing! If you are using Declarative Services with the maven-SCR-plugin, pax-url won't find the servicecomponents.xml, since the plugin by default puts it directly in target (as opposed to target/classes). For this to work, you'll have to add a config stanza to your scr plugin changing the output directory, like so:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
<configuration>
<!-- Without this, PAX-URL won't work -->
<outputDirectory>target/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
精彩评论