You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Cristian Botiza <Cr...@endava.com> on 2010/05/04 11:09:56 UTC

Question on @EJB and JNDI lookup

Hi all.

I had an issue with calling EJBs (stateless) from the web layer.
In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:

Bean '...' was undeployed.

I assumed this is as designed and didn't try to fix it.

However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?

Thanks! Answers much appreciated.

________________________________
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.

Re: Question on @EJB and JNDI lookup

Posted by David Jencks <da...@yahoo.com>.
On May 4, 2010, at 4:18 PM, Cristian Botiza wrote:

> I haven't mentioned (sorry) that the problem is intermitent. I didn't stop the EJB through the console or any other way. I suppose there were some memory limits reached and the container was "forced" to discard the EJB instance. The exception was:
> IllegalStateException: Bean ...JAR/InterfaceName has been undeployed

I don't know what this means.  I would expect it to be a problem no matter how you got the proxy.  When you try to use a proxy, the request gets assigned an instance of the stateless bean for the duration of the call.  Each call gets a new instance assigned.  So if something happens on the server so instances are no longer available, any proxy you may get won't work, for the same reason.

I'd ask on the openejb dev list what this message means, if possible including a stack trace.

thanks
david jencks

>  
> I'm pretty sure an explicit JNDI lookup would fix this, but wanted to avoid doing lookups at each web service call.
> So if I use @EJB I shouldn't fear this problem?
> Thanks again
> From: David Jencks [david_jencks@yahoo.com]
> Sent: 05 May 2010 01:30
> To: user@geronimo.apache.org
> Subject: Re: Question on @EJB and JNDI lookup
> 
> 
> On May 4, 2010, at 2:51 PM, Cristian Botiza wrote:
> 
>> Yes, local interfaces.
>> Just that I'm using the interface name '...Local' when calling JNDI.
>> By the way, CXF is deployed standalone, I added the JARs in the repository. This may explain the issue.
>> However, my question is about servlets (the plain old servlets) and @EJB annotation. Could the injected EJB object (proxy) be undeployed?
> 
> If the war and ejb jar are in the same ear, you would not be able to stop the ejbs without the web app stopping first.
> 
> david jencks
> 
>>  
>> Many thanks
>> From: David Jencks [david_jencks@yahoo.com]
>> Sent: 04 May 2010 19:54
>> To: user@geronimo.apache.org
>> Subject: Re: Question on @EJB and JNDI lookup
>> 
>> I'd need more details to understand what might be going on here.  If you are using POJO web services under the cxf that is installed in geronimo and looking the ejb up in java:comp/env.... then the two approaches should work identically.  I'm also assuming that the ejb is running in the same geronimo instance and you are using local interfaces (although this should not affect anything).
>> 
>> david jencks
>> 
>> On May 4, 2010, at 2:09 AM, Cristian Botiza wrote:
>> 
>>> Hi all.
>>>  
>>> I had an issue with calling EJBs (stateless) from the web layer.
>>> In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:
>>>  
>>> Bean '...' was undeployed.
>>>  
>>> I assumed this is as designed and didn't try to fix it.
>>>  
>>> However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?
>>>  
>>> Thanks! Answers much appreciated.
>>> 
>>> The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
>>> 
>>> Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.
>> 
>> 
> 
> 


RE: Question on @EJB and JNDI lookup

Posted by Cristian Botiza <Cr...@endava.com>.
I haven't mentioned (sorry) that the problem is intermitent. I didn't stop the EJB through the console or any other way. I suppose there were some memory limits reached and the container was "forced" to discard the EJB instance. The exception was:
IllegalStateException: Bean ...JAR/InterfaceName has been undeployed

I'm pretty sure an explicit JNDI lookup would fix this, but wanted to avoid doing lookups at each web service call.
So if I use @EJB I shouldn't fear this problem?
Thanks again
________________________________
From: David Jencks [david_jencks@yahoo.com]
Sent: 05 May 2010 01:30
To: user@geronimo.apache.org
Subject: Re: Question on @EJB and JNDI lookup


On May 4, 2010, at 2:51 PM, Cristian Botiza wrote:

Yes, local interfaces.
Just that I'm using the interface name '...Local' when calling JNDI.
By the way, CXF is deployed standalone, I added the JARs in the repository. This may explain the issue.
However, my question is about servlets (the plain old servlets) and @EJB annotation. Could the injected EJB object (proxy) be undeployed?

If the war and ejb jar are in the same ear, you would not be able to stop the ejbs without the web app stopping first.

david jencks


Many thanks
________________________________
From: David Jencks [david_jencks@yahoo.com]
Sent: 04 May 2010 19:54
To: user@geronimo.apache.org<ma...@geronimo.apache.org>
Subject: Re: Question on @EJB and JNDI lookup

I'd need more details to understand what might be going on here.  If you are using POJO web services under the cxf that is installed in geronimo and looking the ejb up in java:comp/env.... then the two approaches should work identically.  I'm also assuming that the ejb is running in the same geronimo instance and you are using local interfaces (although this should not affect anything).

david jencks

On May 4, 2010, at 2:09 AM, Cristian Botiza wrote:

Hi all.

I had an issue with calling EJBs (stateless) from the web layer.
In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:

Bean '...' was undeployed.

I assumed this is as designed and didn't try to fix it.

However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?

Thanks! Answers much appreciated.

________________________________
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.




Re: Question on @EJB and JNDI lookup

Posted by David Jencks <da...@yahoo.com>.
On May 4, 2010, at 2:51 PM, Cristian Botiza wrote:

> Yes, local interfaces.
> Just that I'm using the interface name '...Local' when calling JNDI.
> By the way, CXF is deployed standalone, I added the JARs in the repository. This may explain the issue.
> However, my question is about servlets (the plain old servlets) and @EJB annotation. Could the injected EJB object (proxy) be undeployed?

If the war and ejb jar are in the same ear, you would not be able to stop the ejbs without the web app stopping first.

david jencks

>  
> Many thanks
> From: David Jencks [david_jencks@yahoo.com]
> Sent: 04 May 2010 19:54
> To: user@geronimo.apache.org
> Subject: Re: Question on @EJB and JNDI lookup
> 
> I'd need more details to understand what might be going on here.  If you are using POJO web services under the cxf that is installed in geronimo and looking the ejb up in java:comp/env.... then the two approaches should work identically.  I'm also assuming that the ejb is running in the same geronimo instance and you are using local interfaces (although this should not affect anything).
> 
> david jencks
> 
> On May 4, 2010, at 2:09 AM, Cristian Botiza wrote:
> 
>> Hi all.
>>  
>> I had an issue with calling EJBs (stateless) from the web layer.
>> In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:
>>  
>> Bean '...' was undeployed.
>>  
>> I assumed this is as designed and didn't try to fix it.
>>  
>> However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?
>>  
>> Thanks! Answers much appreciated.
>> 
>> The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
>> 
>> Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.
> 
> 


RE: Question on @EJB and JNDI lookup

Posted by Cristian Botiza <Cr...@endava.com>.
Yes, local interfaces.
Just that I'm using the interface name '...Local' when calling JNDI.
By the way, CXF is deployed standalone, I added the JARs in the repository. This may explain the issue.
However, my question is about servlets (the plain old servlets) and @EJB annotation. Could the injected EJB object (proxy) be undeployed?

Many thanks
________________________________
From: David Jencks [david_jencks@yahoo.com]
Sent: 04 May 2010 19:54
To: user@geronimo.apache.org
Subject: Re: Question on @EJB and JNDI lookup

I'd need more details to understand what might be going on here.  If you are using POJO web services under the cxf that is installed in geronimo and looking the ejb up in java:comp/env.... then the two approaches should work identically.  I'm also assuming that the ejb is running in the same geronimo instance and you are using local interfaces (although this should not affect anything).

david jencks

On May 4, 2010, at 2:09 AM, Cristian Botiza wrote:

Hi all.

I had an issue with calling EJBs (stateless) from the web layer.
In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:

Bean '...' was undeployed.

I assumed this is as designed and didn't try to fix it.

However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?

Thanks! Answers much appreciated.

________________________________
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.

Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.


Re: Question on @EJB and JNDI lookup

Posted by David Jencks <da...@yahoo.com>.
I'd need more details to understand what might be going on here.  If you are using POJO web services under the cxf that is installed in geronimo and looking the ejb up in java:comp/env.... then the two approaches should work identically.  I'm also assuming that the ejb is running in the same geronimo instance and you are using local interfaces (although this should not affect anything).

david jencks

On May 4, 2010, at 2:09 AM, Cristian Botiza wrote:

> Hi all.
>  
> I had an issue with calling EJBs (stateless) from the web layer.
> In the web layer I was using CXF and doing an explicit JNDI lookup to retrieve the stateless EJB instance (proxy, to be more precise). The issue was that those EJB references were retrieved only once when CXF services were started. After some heavy load on the server, at some point the EJB call failed with message:
>  
> Bean '...' was undeployed.
>  
> I assumed this is as designed and didn't try to fix it.
>  
> However, to avoid it I replaced CXF with plain old servlet and in the servlet class I used @EJB to inject the EJB instances. Everything works fine so far but I wanted to make sure I did the right thing. Is it possible that I run in the same issue with this approach? As I understand it, Geronimo will inject one instance in each servlet instance (and there will be only one servlet instance by default) - this is by the specs. Does Geronimo (OpenEJB) take care of circumstances when the EJB is 'undeployed'? Will it inject a fresh instance?
>  
> Thanks! Answers much appreciated.
> 
> The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection.
> 
> Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.