users@glassfish.java.net

Re: Unable to embed glassfish in an OSGi environment

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Sun, 11 Mar 2012 06:34:34 +0530

You don't have to create the jars yourself. Just download a distribution
of glassfish (in your case nucleus distribution), install it and run the
following command in your framework:

install file:/.../modules/glassfish/jar
start <bundle id>

Thanks,
Sahoo

On Monday 05 March 2012 07:34 PM, Dhananjay Nene wrote:
> 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
>