3

This is related to Jboss AS 7.1, we have been using this to create an EJB for one of our applications,

Our application architecture is such that, all business logic is there in Stored Procedures where in we call the stored procedures from the EJB's, We have a problem where in there are a set of procedures to be called and these all constitute one atomic operations. For example, say a user detail has to be submitted, in this case we have to call 7 different procedures, and each procedure inserts, updates different tables and gives the result back to the EJB, so if one of the call fails all the details inserted or updated in one of the previous operations has to be undone. We learnt that this could be done by introducing transactions.

So we tried using the TransactionManager in Jboss

public ClsXDKRTApp() throws NamingException {
    tx1 = new TransactionManagerLocator().getTM("java:jboss/TransactionManager");
}

Above tx1 is defined as an attribute of the bean Class, and it instantiates properly.

But as soon as we try to begin the transaction we run into the below error

 11:28:08,201 ERROR [stderr] (http--0.0.0.0-8080-1) javax.transaction.NotSupportedException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction!
 11:28:08,201 ERROR [stderr] (http--0.0.0.0-8080-1)     at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:63)
 11:28:08,201 ERROR [stderr] (http--0.0.0.0-8080-1)     at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.begin(BaseTransactionManagerDelegate.java:65)

We have checked different forums for a solution for this, but the usecases mentioned were drastically different from this one.

Any guidance as to how to approach and solve this issue would be highly helpful

kashipai
  • 149
  • 3
  • 13

1 Answers1

0

if EJB is Container Managed there will be default transaction and you can call different procedures with in same call (Make sure do not write commit/rollback in procedure) and EJB container will handle the complete transaction automatically

Avil
  • 453
  • 3
  • 15