wizspark
wizspark

Reputation:

What is the cause of EJB 2.x "reentrant method call detected" Exceptions? How to solve them?

I'm mantaining a EJB 2 CMP legacy app runing on a JBoss 4.0.4 GA application server with deployed entity/stateless session beans. All the EJB boilerplate code is generated via XDoclet from the EntityEJB/EntityEJBManager annotations.

I've noticed that when my GUI client invokes the facade create method, I have lots of cases of EJBException in my server log with the "Reentrant method call detected" message, which rollbacks the transaction.

What does this Exception means? How can I avoid having such error (which unfortunately, I wasn't able to reproduce yet)


Update: Found this link that explains what is meant by reentrancy, however, seems to me that it says my app cannot be accesed concurrently?

Upvotes: 2

Views: 1577

Answers (3)

Keith Humphreys
Keith Humphreys

Reputation: 11

we just came across the same problem and our solution was two-fold. Firstly we ensure that none of ejb's had transaction attributes of NotSupported within our ejb-jar.xml. We then used "instance per transaction" as our optimistic locking strategy. It's a bit of a belt-and-braces approach, but it works

Upvotes: 1

Aaron
Aaron

Reputation:

I've seen this before where EJB1 calls EJB2 which calls back to EJB1 within the container as part of the same transaction.

You can tell the container to allow this by marking EJB1 as reentrant which will allow it to be accessed multiple times in the same transaction.

This is done in the deployment descriptor with the following tag:

<reentrant>True</reentrant>

There should be a corresponding EntityEJB annotation that XDoclet can use to generate this for you.

Upvotes: 1

Robin
Robin

Reputation: 24282

It does mean that the Entity bean in question cannot be accessed concurrently, which makes sense since it would likely corrupt the data.

Upvotes: 0

Related Questions