• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1501
  • Last Modified:

I fail setting the transaction timeout in Weblogic 8.1sp5

In my case, I try to use one XA transaction to coordinate multiple databases operation, so I setup multiple XA-style DBPool according to the multiple databases. I set the "Enable XA Transaction Timeout=true" & "XA Transaction Timeout=300" in every XA-style DBPool via Weglogic admin console. But after I restart the server and test my code with it. This exception "Transaction timed out after 31 seconds" thrown by weblogic. Could you advise me how to set the transaction timeout correctly?
0
baabul
Asked:
baabul
  • 2
1 Solution
 
ECollinCommented:
hi,

are you using ejbs ?
Do you managed transaction inside your code, or do you left the container to deal with ?

Emmanuel
0
 
baabulAuthor Commented:
Hi,

No ejb's in my case. I use the Hibernate(3.1.3) as the data access tier. Actually I create multiple XA-style datasources in weblogic for my different databases, then config these datasources in Hibernate for creating multiple SessionFactories (one factory for one database). Then implement a JTA interceptor for handling the transaction. When a jta method is invoked, my interceptor will capture it and inject jta transaction code before and after its invoking. The pseudocode has been appended in the end for your reference. The UserTransaction got from weblogic will control the whole transaction processing, so I config its timeout in weblogic will affect on my code. But it's not, the exception "Transaction timed out after 31 seconds" is still thrown by weblogic. I don't know how I can handle it, please advise.

Thanks,
Amax

*****my code************
UserTransaction tx = null;
try {                        
      Context ctx = JndiHelper.instance().getContext();
      String jtstransaction = "javax.transaction.UserTransaction";
      
      if(JndiHelper.instance().getJndiParam("jta.UserTransaction")!=null){
            jtstransaction = JndiHelper.instance().getJndiParam("jta.UserTransaction");
      }
      
      tx = (UserTransaction)ctx.lookup(jtstransaction);
      tx.begin();
      Object retObject = method.invoke(target, args);
      tx.commit();
      return retObject;
}catch(Exception e){
    if(tx!=null){
          tx.rollback();
    }
    throw new Exception(e.getCause());
}
************************
0
 
baabulAuthor Commented:
All,

I have finished my case, just set the UserTransaction.setTimeout to the seconds I expect.

Thanks,
Amax
0
 
GhostModCommented:
PAQed with points refunded (20)

GhostMod
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now