users@glassfish.java.net

Re: EJBs in OSGi Bundles

From: Sanjeeb Sahoo <sahoo_at_sun.com>
Date: Tue, 08 Jun 2010 18:10:17 +0530

So, you are using a 3.1 build of glassfish? Is this correct?

That blog is slightly old; since then the implementation has changed.
Originally my thinking was same as yours. i.e., let deployment of EJBs
happen first followed by activation of the bundle. But, then I realized
that in a dynamic environment like OSGi, no assumption should be made
about bundle start order. It should be possible to first deploy an
EJB/OSGi bundle and have it started followed by deployment of OSGi/EJB
container. In such a case, as you can see, the bundle activator for
EJB/OSGi bundle would have run before the OSGi/EJB container had a
chance to deploy the EJBs. So, I changed our implementation to listen
for STARTED event rather than STARTING event in OSGi. This is why you
are seeing activator running before the EJB deployment. How exactly is
it causing problems for you? The EJBs will automatically get published
as OSGi services. What are you doing in your activator that requires
strict ordering? If you want to use the service in your activator, then
I suggest you use ServiceTracker just like the client bundle uses it in
that blog post.

Thanks,
Sahoo

On Tuesday 08 June 2010 03:47 PM, glassfish_at_javadesktop.org wrote:
> Hi Sahoo,
>
> First of all thank you for the various blog entries describing the yet experimental art of EJB deployment by means of OSGi ! Thanks to those I was able to set it all in motion.
>
> I'm having a problem who's solution eludes me: I'm using session beans I need to publish as OSGi services. Luckily I found your article (http://www.java.net/print/242458). I'm having a problem though: The activator (reference 2b in your article) kicks in [b]before[/b] the EJB is deployed. While this construction can only work in the inverse scenario of course.
>
> I've tried various settings at no prevail. A logical solution seemed to me to add the dependency of my service bundle with the bundle "org.glassfish.osgiejb"; to force it load that bundle before. And hoping it would deploy the EJB too. Waiting for the EJB deployment in background doesn't work either because it seems to be waiting for the activator to complete. Once it completes you see the logging appear of the EJB being deployed.
>
> I've installed the bundle "osgi-ejb-container-3.1-SNAPSHOT.jar" btw.
>
> I'm rather stuck here. I'm rather new to OSGi, so I don't know what else to try. I used the nightly builds of yesterday for both GF and the OSGi EJB container.
>
> Do you know by any chance how I can reverse the order of deployment ? First deploy the EJB and AFTER that having the bundle activator start ?
>
> Regards& thanks,
>
> Jan
> [Message sent by forum member 'jan_goyvaerts']
>
> http://forums.java.net/jive/thread.jspa?messageID=473287
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>