-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 3.5.6 causing 2phase commit problem
PostPosted: Tue Feb 22, 2011 3:13 pm 
Newbie

Joined: Wed Jan 05, 2011 3:22 pm
Posts: 13
Hi

Let me just give some high level scenario of my application. This is working application but started giving problem with new HB jars

Im using WAS 6.1.0.29 with Oracle 10g and Hibernate 3.5.6 (upgraded in my application from old version) and ehcahce 2.3.2

I am facing an issue whenever Im trying to do some update I get above exception inside EJB. This was not the case earlier and my code did not change between HB upgrade.

This is overall flow
Message arrive in EJB onMessage()

{
UserTransaction transaction = getContext().getUserTransaction();

....then all my Reporting framework kicks in where I call e.g.

report.processReport(userTransaction Tx,..,..)...
{
Tx.begin()
isStartedHere = StatHBTransaction();
success = reporting(); // return success
//..it calls Jasper reporting module (JRXML) which internally calls .japser subreport by passing HB connection as parameter //e.g. Connection subreportConn = HibernateUtility.currentSession().connection(); <<= this is deprecated

HB.currentSession().update(success);
hibernate.transaction.commit();<<== here I get WTRN0062E
Tx.rollback/commit based on report output <== never reaches here
}

}

Im not using XA drivers and my bean is also not managed by container.

ejb-jar.xml
<transaction-type>Bean</transaction-type>

Any help would be appreciated


Top
 Profile  
 
 Post subject: Re: Hibernate 3.5.6 causing 2phase commit problem
PostPosted: Tue Feb 22, 2011 3:14 pm 
Newbie

Joined: Wed Jan 05, 2011 3:22 pm
Posts: 13
I also tested with JBoss 4.0.3 SP1 it gives me error saying

13:47:42,684 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=XXXXXXX-XXX/66, BranchQual=, localId=66] timed out. status=STATUS_ACTIVE


Top
 Profile  
 
 Post subject: Re: Hibernate 3.5.6 causing 2phase commit problem
PostPosted: Tue Feb 22, 2011 4:49 pm 
Newbie

Joined: Wed Jan 05, 2011 3:22 pm
Posts: 13
May be I should be clear with calls when I written
StatHBTransaction

basically we use OpenSession instead of getCurrentSession of Hibernate. This is all handled by our own utility classes.

The way its works above is

transactionStartedHere = startService(methodName, ReportClass.class); <= this will start a transaction on Hibernate

and the same way commit/rollbacks are handled using utility classes. My Hibernate.cfg.xml looks like

<!-- COMMON Properties -->
<property name="hibernate.current_session_context_class">
org.hibernate.context.ThreadLocalSessionContext
</property>
<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>
<!-- <property name="jta.UserTransaction">jta/usertransaction</property> -->
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>

Also I came across this link http://docs.jboss.org/hibernate/core/3. ... ansactions which says I dont need to call beginTransaction is UserTransaction already started and also to use "jta" for current_session_context_class property

Is there a way to go back to earlier stage so that I dont have to change my code (or minimize it)?

Hoping to get some details here


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.