@PostContruct bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

@PostContruct bug?

joe-2
Hi,

I have a stateless bean with a method which is annotated with
@PostConstruct. This method throws an unchecked exception.

So when the client (swing app) invokes this EJB for the first time, the
following exception is catched by the client:

javax.ejb.EJBException: Cannot obtain a free instance.; nested exception
is: java.lang.RuntimeException: test exception

That looks ok for me.
But all future invocations(until restarting OpenEJB server) of this EJB
throw the following exception

javax.ejb.ConcurrentAccessTimeoutException

For me this looks like the EJB is in use, although it should never be in
use cause the @PostContruct method throwed an (unchecked) exception
and no other EJB method is invoked.

For testing i wrote a stateless EJB with a @PostContruct method just
throwing a RuntimeException and i configured the container by setting
the MaxSize to 1.

<Container id="My Stateless Container" type="STATELESS">
   ...
   MaxSize = 1
   ...
</Container>

I also tested MaxSize = 2. Then the first exeception is catched 2 times,
all other times, the second exception is catched.

And i also tested no pooling (MaxSize = 0,  StrictPooling = false), then
always the first exception is catched.

Looks like a bug for me, isn't it?
Reply | Threaded
Open this post in threaded view
|

Re: @PostContruct bug?

dblevins
Administrator
Hmm.  I swear we have a unit test for this.  Will have to check that out immediately.  If this is an issue (sounds like that's the case) then we'll have to fix it and reroll the 3.1.4 binaries that are currently up for a vote.

-David

On Nov 3, 2010, at 12:32 PM, joe wrote:

> Hi,
>
> I have a stateless bean with a method which is annotated with @PostConstruct. This method throws an unchecked exception.
>
> So when the client (swing app) invokes this EJB for the first time, the following exception is catched by the client:
>
> javax.ejb.EJBException: Cannot obtain a free instance.; nested exception is: java.lang.RuntimeException: test exception
>
> That looks ok for me.
> But all future invocations(until restarting OpenEJB server) of this EJB throw the following exception
>
> javax.ejb.ConcurrentAccessTimeoutException
>
> For me this looks like the EJB is in use, although it should never be in use cause the @PostContruct method throwed an (unchecked) exception
> and no other EJB method is invoked.
>
> For testing i wrote a stateless EJB with a @PostContruct method just throwing a RuntimeException and i configured the container by setting the MaxSize to 1.
>
> <Container id="My Stateless Container" type="STATELESS">
>  ...
>  MaxSize = 1
>  ...
> </Container>
>
> I also tested MaxSize = 2. Then the first exeception is catched 2 times, all other times, the second exception is catched.
>
> And i also tested no pooling (MaxSize = 0,  StrictPooling = false), then always the first exception is catched.
>
> Looks like a bug for me, isn't it?
>

Reply | Threaded
Open this post in threaded view
|

Re: @PostContruct bug?

dblevins
Administrator
On Wed, Nov 3, 2010 at 2:06 PM, David Blevins <[hidden email]> wrote:
> Hmm.  I swear we have a unit test for this.  Will have to check that out immediately.  If this is an issue (sounds like that's the case) then we'll have to fix it and reroll the 3.1.4 binaries that are currently up for a vote.

Found and fixed.  Thank you for reporting it!

https://issues.apache.org/jira/browse/OPENEJB-1394


-David


> On Nov 3, 2010, at 12:32 PM, joe wrote:
>
>> Hi,
>>
>> I have a stateless bean with a method which is annotated with @PostConstruct. This method throws an unchecked exception.
>>
>> So when the client (swing app) invokes this EJB for the first time, the following exception is catched by the client:
>>
>> javax.ejb.EJBException: Cannot obtain a free instance.; nested exception is: java.lang.RuntimeException: test exception
>>
>> That looks ok for me.
>> But all future invocations(until restarting OpenEJB server) of this EJB throw the following exception
>>
>> javax.ejb.ConcurrentAccessTimeoutException
>>
>> For me this looks like the EJB is in use, although it should never be in use cause the @PostContruct method throwed an (unchecked) exception
>> and no other EJB method is invoked.
>>
>> For testing i wrote a stateless EJB with a @PostContruct method just throwing a RuntimeException and i configured the container by setting the MaxSize to 1.
>>
>> <Container id="My Stateless Container" type="STATELESS">
>>  ...
>>  MaxSize = 1
>>  ...
>> </Container>
>>
>> I also tested MaxSize = 2. Then the first exeception is catched 2 times, all other times, the second exception is catched.
>>
>> And i also tested no pooling (MaxSize = 0,  StrictPooling = false), then always the first exception is catched.
>>
>> Looks like a bug for me, isn't it?
>>
>
>