File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Application Error: tried to enter Stateful bean with different tx context, contextTx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Application Error: tried to enter Stateful bean with different tx context, contextTx" Watch "Application Error: tried to enter Stateful bean with different tx context, contextTx" New topic
Author

Application Error: tried to enter Stateful bean with different tx context, contextTx

Chris Jackal
Greenhorn

Joined: Mar 18, 2005
Posts: 4
Hi,

I will access a Statefull Session Bean (SFSB) do to a little work for me. I have a web application and take care that every user have his own SFSB to avoid multiple access.
Now I have the following problem with my SFSB and JBoss 3.2.6 : When one user double click or click to fast two different links (which were processed by the same SLSB) I get the following exception :

javax.ejb.EJBException: Application Error: tried to enter Stateful bean with different tx context, contextTx: TransactionImpl:XidImpl

I have read in EJB Spec that the behaviour is while during the first transaction run the second transaction is not authorized to enter the SFSB.

Now my question : How can I avoid that the SFSB is called when a transaction is running ?

Regards

Chris
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Chris,

Not sure if I can help you much, since I'm not using JBoss very often. The only hint I can provide you is related to my experience with weblogic. I know that weblogic has a special tag <allow-concurrent-calls> (which defaults to false) that basically overcomes this limitation and will allow concurrent method calls to the same SFSB instance. Check on the JBoss forum maybe there is a similar configuration for JBoss as well.
Regards.


I think, therefore I exist -- Rene Descartes
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Another way you might overcome this problem is to use the business delegate pattern, synchronizing the access methods in your business delegate. Something like this:

Client --> Servlet/JSP --> BusinessDelegate(synchronized method) --> Bean

You might store the business delegate in the HttpSession object and must be serializable (most servlet engines passivates HttpSession objects).
Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application Error: tried to enter Stateful bean with different tx context, contextTx