-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate and JBOSS JTA failed transactions
PostPosted: Tue Sep 05, 2006 12:49 pm 
Beginner
Beginner

Joined: Fri Jul 28, 2006 12:01 pm
Posts: 21
I am having problems using Hibernate with JBoss JTA. Transactions seem to be hit or miss. Sometimes they work, sometimes they fail. When they fail, I get this exception.

org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager

Hibernate version: 3.1

Mapping documents:
Jboss-web.xml
----------------
Code:
<resource-ref>
      <res-ref-name>hibernate/SessionFactory</res-ref-name>
      <jndi-name>java:/hibernate/SessionFactory</jndi-name>
  </resource-ref>


web.xml
-----------------
Code:
<resource-ref>
        <res-ref-name>hibernate/SessionFactory</res-ref-name>
        <res-type>net.sf.hibernate.SessionFactory</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>


jboss-service.xml -inside a har archive
----------------------------------------------
Code:
<mbean code="org.jboss.hibernate.jmx.Hibernate"
           name="jboss.har:service=Hibernate">
        <attribute name="DatasourceName">java:/XAOracleDS</attribute>
        <attribute name="Dialect">org.hibernate.dialect.Oracle9Dialect</attribute>
        <attribute name="SessionFactoryName">java:hibernate/SessionFactory</attribute>
        <attribute name="ShowSqlEnabled">true</attribute>
        <!--<attribute name="TransactionStrategy">net.sf.hibernate.transaction.JDBCTransactionFactory</attribute>-->
        <!--<attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>-->
        <!--<attribute name="UserTransactionName">UserTransaction</attribute>-->       
        <!--<attribute name="CacheProviderClass">
            org.hibernate.cache.HashtableCacheProvider
        </attribute>-->
        <!-- <attribute name="Hbm2ddlAuto">create-drop</attribute> -->
    </mbean>



Name and version of the database you are using: Oracle 10g Rel 1

Oracle datasource
---------------------
Code:
<datasources>
  <xa-datasource>
    <jndi-name>XAOracleDS</jndi-name>
    <track-connection-by-tx/>
    <isSameRM-override-value>false</isSameRM-override-value>
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    <xa-datasource-property name="URL">jdbc:oracle:thin:@192.168.193.133:1521:ora1</xa-datasource-property>
    <xa-datasource-property name="User">budget_access</xa-datasource-property>
    <xa-datasource-property name="Password">budget_access</xa-datasource-property>
   
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
    <no-tx-separate-pools/>
    <!--pooling parameters-->
    <min-pool-size>1</min-pool-size>
    <max-pool-size>100</max-pool-size>
    <blocking-timeout-millis>5000</blocking-timeout-millis>
    <idle-timeout-minutes>15</idle-timeout-minutes>
      <metadata>
         <type-mapping>Oracle9i</type-mapping>
      </metadata>
  </xa-datasource>

  <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
         name="jboss.jca:service=OracleXAExceptionFormatter">
    <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
  </mbean>

</datasources>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 7:08 pm 
Newbie

Joined: Sat Jan 15, 2005 5:45 pm
Posts: 2
I got the same problem [org.hibernate.TransactionException: Could not register synchronization for container transaction] but I'm using websphere and WebSphereExtendedJTATransactionLookup with CMTTransactionFactory

Code:
12 Sep 2006 18:43:23 ERROR MYCheckedException:294 - Checked Exception: OpenSessionException
org.hibernate.TransactionException: Could not register synchronization for container transaction
   at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45)



I tried to remove the exception from CMTTransaction: 45 in hibernate source
Code:
      if ( !synchronization ) {
         //throw new TransactionException("Could not register synchronization for container transaction");
         log.error("Could not register synchronization for container transaction");


and my system got work with no errors.
So I've two questions,
What happen with syncrhonization? Can i disable the synchronization check with no collaterals effects ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.