users@glassfish.java.net

Re: OSGI Web bundle

From: Pavel Kuzin <pk_at_nodex.ru>
Date: Tue, 20 Oct 2009 14:14:14 +0400

Sahoo пишет:
> Hello Pavel,
>
> I am having difficulty understanding your scenario. The relationship
> between life cycle of OSGi bundle and web app is shown here:
>
> [1]
> http://weblogs.java.net/blog/ss141213/archive/2009/06/developing_hybr.html
>
> As shown there, GlassFish OSGi Web Container deploys the web app when
> the web bundle moves to STARTING state. By deploying a web app, I mean a
> ServletContext is created for the web app. A bundle context is already
> associated with an OSGi bundle in STARTING state.
>
> Please see more response inline...
>
>
> Pavel Kuzin wrote:
>> Hello!
>>
>> I`m trying to migrate from Spring DM Server to Glassfish v3 with OSGI.
>> I`m successfully deployed my OSGI bundles ( parts of application).
>> And when i`m trying to install last Web Bundle then Glassfish`s
>> osgi-web-container
>> tries to activate web application before bundle context is activated
>> and initialised.
> 1) What do you mean by osgi-web-container "tries to activate web
> application?" osgi-web-container does not call bundle.start() or
> anything like that.
> 2) Are you sure osgi-web-container came into picture when you
> "installed" the web bundle? It is supposed to come into picture upon
> receiving a STARTING event or a LAZY_ACTIVATION event.
> 3) How are you installing the bundles in the first place? Are you using
> "asadmin deploy" command? There may be issues with that command.
> Instead, can you try copying your bundles to
> glassfish/domain1/autodeploy/bundles directory?
>
> I expect this to happen:
> Once you copy the bundles to that directory, FileInstall bundle will try
> to start the bundle. Before the bundle is activated (i.e., bundle's
> activator.start() method is called), osgi-web-container will process the
> bundle and deploy it to underlying web container. Then, bundle's
> activator will be called. I am not sure when spring's osgi extender
> comes into picture. If it is also trying to extend the bundle in
> STARTING state, there is a potential race condition between
> osgi-web-container and spring-osgi-extender. If it tries to extend in
> STARTED state, I don't see any issue.
>
> Please feel free to raise your questions in this forum.
>
> Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>

I was tried to look Spring extender sources for this point.

Seems osgi-web-container tries to deploy webapp in STARTING state.
And then Spring osgi extender tries to extend bundle in STARTED state.

And in this case, my webapp does not see Spring DM bundle context, because it
is not yet loaded.

And seems OSGI with Spring DM needs

And then Spring osgi extender tries to extend bundle in STARTING state.
osgi-web-container tries to deploy webapp in STARTED state.

Or something like this.

I`m also tried to deploy spring-osgi-web-extender with glassfish but without be lucky.
spring-osgi-web-extender throws Exteption. It can`t find class org.apache.catalina.Loader in init state.


-- 
Pavel D. Kuzin
pk_at_nodex.ru
Nodex LTD.
Saint-Petersburg, Russia