aspose file tools*
The moose likes JBoss/WildFly and the fly likes Multiple last resources have been added to the current transaction. This is transactionally unsafe a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Multiple last resources have been added to the current transaction. This is transactionally unsafe a" Watch "Multiple last resources have been added to the current transaction. This is transactionally unsafe a" New topic
Author

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

adi reddy
Greenhorn

Joined: Apr 24, 2012
Posts: 8
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

Joined: Jul 20, 2005
Posts: 10201
    
166

See https://community.jboss.org/wiki/Multiple1PC

[My Blog] [JavaRanch Journal]
adi reddy
Greenhorn

Joined: Apr 24, 2012
Posts: 8
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

Joined: Jul 20, 2005
Posts: 10201
    
166

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Multiple last resources have been added to the current transaction. This is transactionally unsafe a