Cannot use PAX-URL's assembly protocol with auto started bundles in Felix config.properties

余生颓废 提交于 2019-12-11 00:50:01

问题


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/my/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!


回答1:


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




回答2:


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>


来源:https://stackoverflow.com/questions/5103505/cannot-use-pax-urls-assembly-protocol-with-auto-started-bundles-in-felix-config

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!