users@glassfish.java.net

Unable to embed glassfish in an OSGi environment

From: Dhananjay Nene <dhananjay.nene_at_gmail.com>
Date: Mon, 5 Mar 2012 19:34:45 +0530

I am attempting to embed glassfish in an OSGi environment, and to that end
have created OSGi compatible jars including that for
glassfish-embedded-nucleus version 3.1.1 (I couldn't find a maven repo
hosting 3.1.2)

The OSGi container I'm using is eclipse.

However when I attempt to start glassfish in an embedded fashion, here's
the exception I run into

java.lang.IllegalArgumentException: Don't support packaging
bundleresource://13.fwk701179797/com/sun/enterprise/glassfish/bootstrap/ASMain.class
, please contribute !
at com.sun.enterprise.module.bootstrap.Which.jarFile(Which.java:75)
at
com.sun.enterprise.glassfish.bootstrap.ASMainHelper.findBootstrapFile(ASMainHelper.java:360)
at
com.sun.enterprise.glassfish.bootstrap.ASMainHelper.findInstallRoot(ASMainHelper.java:332)
at
com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntimeBuilder.getInstallRoot(StaticGlassFishRuntimeBuilder.java:114)
at
com.sun.enterprise.glassfish.bootstrap.StaticGlassFishRuntimeBuilder.build(StaticGlassFishRuntimeBuilder.java:76)

I could figure out it is trying to find the source of the class, and the
OSGi container is returning a path with the protocol bundleresource://
which is not recognised.

I looked at the source and currently it just accepts a "jar://" protocol
(at line 69 on Which.java in hk2 core). I am not sure if there is any way I
can make this work.

Is there a way I could embed glassfish in an OSGi environment?

Dhananjay