Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple last resources have been added to the current transaction. This is transactionally unsafe a

 
adi reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two DataSource to be executed in EJB bean class.

the following is the my EJB class code:


The AbcTimerLocal is as follows:


In some servelt i am calling the setTimerInterval() method, in this the timer is creating, so that every 5000 millisec the Time Out ( handleCallback(..)) will call. In the callback or time out method i am calling two different DAO's which are call two different DataSources and will execute some SQL statements.

while executing the second DAO method, i am getting the following WARN message in JBoss server.log

WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] Multiple last resources have been added to the current transaction. This is transactionally unsafe and should not be relied upon. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@d38525

My question is , Why I am getting this WARM message and under waht situation will get this message?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
 
adi reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks JaiKiran,

I ahve seen that link already and i have done some changes in time out method:

i have created one method inside my EJB class as follows:


calling this method in the time out method


according to that thread which you posted, the method which annotated with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) will execute its own transactional context.
But i dont know what wrong with above code, still I am getting WARN messages.
I have tried to call both DAO methods like above but no use...........
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
adi reddy wrote:
calling this method in the time out method


according to that thread which you posted, the method which annotated with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) will execute its own transactional context.


You are just doing a plain Java call. So that won't work and won't create a new transaction. See this thread for more details https://community.jboss.org/message/525521#525521
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic