users@glassfish.java.net

Re: Embed Apache Felix in a Web Application

From: <glassfish_at_javadesktop.org>
Date: Wed, 23 Jun 2010 02:19:58 PDT

Thanks for your answer.

This is the Felix configuration file I'm currently using:

##############
org.osgi.framework.storage.clean=onFirstInit
org.osgi.framework.bundle.parent=framework
felix.bootdelegation.implicit=true
felix.log.level=4
org.apache.felix.http.debug=true
osgi.shell.telnet.port=7789
##############

Reading the glassfish log what i can see is that Apache Felix HTTP Bridge doesn't load with such errror:

[#|2010-06-23T10:56:13.312+0200|INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=44;_ThreadName=Thread-1;|ERROR: Error starting file:/C:/glassfishv3/glassfish/domains/domain1/applications/webapp.felix/WEB-INF/bundles/org.apache.felix.http.bridge-2.0.4.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.http.bridge [3]: package; (package=javax.servlet))|#]

[#|2010-06-23T10:56:13.312+0200|SEVERE|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=44;_ThreadName=Thread-1;|org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.http.bridge [3]: package; (package=javax.servlet)
        at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3263)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1597)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1077)
        at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
        at java.lang.Thread.run(Thread.java:619)
|#]

I've also tried to put "app" as org.osgi.framework.bundle.parent value in place of "framework" but nothing changes.

Adding following line to Felix configuration file:

org.osgi.framework.system.packages.extra=javax.servlet, javax.servlet.http

doesn't help :(

Have you any other suggestions?

Reason why I want to embed Felix in my WebApp is that I want to use it as a plugin framework and I need it to be independent from the underlying application server.

Thanks in advance

> You must have configured system bundle to export
> javax.servlet package
> for embedded Felix. What class loader have you
> configured as the parent
> class loader for embedded Felix? Try setting
>
> org.osgi.framework.bundle.parent=framework
>
> in your felix config file.
>
> Having said that why would you embed Felix in your
> webapp deployed in
> GlassFish v3 when GlassFish v3 is already deployed
> inside Felix? Your
> web app can already be deployed as an OSGi bundle
> allowing it to take
> advantage of both Java EE and OSGi APIs.
>
> Sahoo
>
[Message sent by forum member 'dboltri']

http://forums.java.net/jive/thread.jspa?messageID=475486