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>