Johan's blog
Using Knopflerfish Desktop in GlassFish v3
Using Knopflerfish Desktop in GlassFish v3 In a previous blog entry, I wrote about running GlassFish v3 on the KnopflerFish OSGi Framework. I spent some more time on this, in particular I managed to use the KnopflerFish Desktop bundle to inspect the GlassFish Bundles and Services. In order to run GlassFish v3 on the KnopflerFish OSGi Framework, follow the steps described here.
That post ended with the report of a missing gf.xargs. I created a gf.xargs file in the KNOPFLERFISH_HOME directory, containing the contents of the default props.xargs file that comes with the Knopflerfish distribution, and added the following lines:
-Dorg.knopflerfish.gosg.jars=file:/home/johan/glassfish/v3/svn/v3/target/glassfish/
-init
-initlevel 1
-install modules/tiger-types-osgi-0.3.9.jar
-install modules/auto-depends-0.3.9.jar
-install modules/config-0.3.9.jar
-install modules/hk2-core-0.3.9.jar
-install modules/osgi-adapter-0.3.9.jar
-install modules/log/log_all-2.0.0.jar
-install modules/cm/cm_all-2.0.0.jar
-install modules/console/console_all-2.0.0.jar
-install modules/util/util-2.0.0.jar
-install modules/remotefw/remotefw_api-2.0.0.jar
-install modules/desktop/desktop_all-2.0.1.jar
-startlevel 7
-start modules/tiger-types-osgi-0.3.9.jar
-start modules/auto-depends-0.3.9.jar
-start modules/config-0.3.9.jar
-start modules/hk2-core-0.3.9.jar
-start modules/osgi-adapter-0.3.9.jar
-start modules/log/log_all-2.0.0.jar
-start modules/cm/cm_all-2.0.0.jar
-start modules/console/console_all-2.0.0.jar
-start modules/desktop/desktop_all-2.0.1.jar
This will install and start a number of OSGi bundles. Most of these bundles are already in the GlassFish modules directory, the others can be copied from the KnopflerFish distribution (log, util, cm, console, remotefw, desktop)
You also need to create a file gfpackages.txt in the same directory, containing a list of packages that are exported from the system classloader (e.g. sun.security.action). I got this list from the GFv3-TP2 build, in the glassfish/felix/conf/config.properties file.
If you now start the GlassFish server, e.g. asadmin start-domain --verbose, the OSGi Framework will be launched.
The desktop bundle will be started, and at least in my case the following window is displayed:
This is the window created by the Desktop Bundle available in KnopflerFish. It allows you to see what bundles/services are registered, which packages are being imported/exported,... in a user-friendly way.
Some more pointers to GlassFish v3 and OSGi:
Arun Gupta's Blog
Geertjan Wielenga's tips on OSGi and GlassFish
Aquarium posts tagged with OSGi


See http://www.knopflerfish.org for more information.
Loading xargs url file:/Users/arungupta/tools/glassfish/v3/2269/glassfishv3/glassfish/osgi/knopflerfish.org/osgi/gf.xargs
java.net.MalformedURLException: no protocol: modules/log_all-2.0.0.jar