users@glassfish.java.net

Re: lookup ejb from OSGI ServiceListener

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Mon, 06 Jun 2011 13:24:13 +0530

On Monday 06 June 2011 01:09 PM, forums_at_java.net wrote:
> [quote=Sahoo]Are you not removing the ServiceListener in preDestroy
> method of
> the EJB? I could reproduce by not removing the listener.[/quote]
>
> Thank you, you are absolutely right: preDestroy with
> removeServiceListener
> solved the problem. Could you explain why the EJB is destroyed
> immediately
> after the war is loaded?
Because various osgi modules are dyamically coming into picture, your
app is getting redeployed. A redeploy causes the old ejbs to go away.
You can configure your bundles to use a higher start level to avoid this
redeployment if you want.

Sahoo