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 MdB timeout / transaction / redelivery issue 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 "MdB timeout / transaction / redelivery issue" Watch "MdB timeout / transaction / redelivery issue" New topic
Author

MdB timeout / transaction / redelivery issue

sebastien chausson
Greenhorn

Joined: Feb 09, 2009
Posts: 1
I'm new with Mdb, and I cannot figure out how to setup the transaction/timeout properly :
I defined a MdB that have a long (up to dozens of minutes) processing to execute when it receives a message :
This processing performs many read/write operations in DB (using an injected entityManager in my MdB), and basically, it stops after about 5-6 minutes (I use JBoss 4.2.0 GA), without any particular exception/log in the jboss console. The message is delivered again (because I added a trace in the onMessage() method and I see it again...) and the process start again from the beginning.

I suspected a transaction timeout issue, and gave a try to the jboss specific annotation on the onMessage() method :
@TransactionTimeout(value=100000)
but it did'nt change anything on the behavior of my application : here is the the jboss console error :

16:41:40,062 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id -53e0fc88:64e:49904cca:54 invoked while multiple threads active within it.
16:41:40,062 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action -53e0fc88:64e:49904cca:54 aborting with 1 threads active!
16:41:40,062 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
16:41:40,062 ERROR [JDBCExceptionReporter] The result set is closed.
16:41:40,078 ERROR [AbstractEntityManagerImpl] Unable to mark for rollback on PersistenceException:
java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active!
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.setRollbackOnly(TransactionImple.java:344)

I tried out to set @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) at the MdB level :
Everything works fine if I don't perform the read/write operations on the DB...
If I try to call my Entity manager operations, It fails with following trace :
18:08:47,281 ERROR [JmsServerSession] Unexpected error delivering message org.jboss.mq.SpyObjectMessage {
Header {
jmsDestination : QUEUE.PreLoadingQueue
jmsDeliveryMode : 2
jmsExpiration : 0
jmsPriority : 4
jmsMessageID : ID:3-12341991371091
jmsTimeStamp : 1234199137109
jmsCorrelationID: null
jmsReplyTo : null
jmsType : null
jmsRedelivered : false
jmsProperties : {}
jmsPropReadWrite: false
msgReadOnly : true
producerClientId: ID:3
}
}
javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction
at org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:150)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:181)



What should I do to make it work ? Using a Bean Managed Transaction ?



Many thanks
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Why are you performing DB operations from your MDB??


If you want something you never had do something which you had never done
 
Don't get me started about those stupid light bulbs.
 
subject: MdB timeout / transaction / redelivery issue