[jboss-user] [EJB 3.0] New message: "Entity Manager with BMT and Transaction Timeout"
Alexander Hartner
do-not-reply at jboss.com
Wed Feb 24 09:13:47 EST 2010
User development,
A new message was posted in the thread "Entity Manager with BMT and Transaction Timeout":
http://community.jboss.org/message/528190#528190
Author : Alexander Hartner
Profile : http://community.jboss.org/people/ejb3workshop
Message:
--------------------------------------------------------------
When running small loads on our application all is working fine, however under heavy concurrent load we consistently get the following exception.
> 2010-02-09 12:40:56,773 FATAL [com.abc.IndexOutputStream.deliverJob] failed to lazily initialize a collection of role: com.abc.entities.ChannelJob.m_jobProperties, no session or session was closed
> org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.abc.entities.ChannelJob.m_jobProperties, no session or session was closed
My suspicious were that the underlying JTA transaction has timed-out and that the entity manager session was closed, so I tried increasing the global transaction timeout from 300 to 3600.
> <!-- JBoss Transactions JTA -->
> <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
> name="jboss:service=TransactionManager">
> <attribute name="TransactionTimeout">*3600*</attribute>
> <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute>
> </mbean>
However this did not resolve my problem. Shortly (between 5 to 10 minutes) after starting the transaction the same exception occured again. I am injecting a UserTransaction as well as an EntityManager into a MessageDrivenBean and then manage the transaction myself. I found some posts that suggest in this case I have to join the EntityManager to the JTA transaction using +entityManger.joinTransaction()+ which I wasn't doing up to this point. It seemed to have had a positive impact, but I am still testing if this was really the cause of the problem.
What I am looking for is some clarification on if this is really the case that I have to join the transaction and if I don't join where the timeout for the entity manager is configured. I had a look at the Hibernate documentation, but didn't find any reference to a timeout, other then on the entity cache.
Ideally I would like to resolve this issue by changing my environment rather then the application.
Thanks in advance
Alex
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/528190#528190
More information about the jboss-user
mailing list