Hi guys,
I have had problems with hibernate 2 when using it in WAS 5.X. The problem concerns the management of transactions.
I have an EJB Session Bean method which requires a transaction. I have configured the .cfg.xml file to use JTATransactionFactory and a ConnectionProvider like this:
<!-- Part of my configuration file -->
<property name="connection.datasource">jdbc/qgraosDs</property>
<property name="dialect">net.sf.hibernate.dialect.OracleDialect</property>
<property name="connection.provider_class">br.com.project.hibernate.websphere.WSDataSourceConnectionProvider</property>
<property name="jta.UserTransaction">jta/usertransaction</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</property>
... (the mappings)
I implemented a connection provider class - br.com.project.hibernate.websphere.WSDataSourceConnectionProvider - as specified in Wiki Community Area Hibernate in WAS 5.x - fixes possible deadlock problem (
http://www.hibernate.org/204.html ).
Well, I have done all this and, in my DAO layer and I call hibernate open session and begin transaction before perfoming any database method such as findBykey, create, and after I commit the transaction and close the session.
So here is the problem, specfically, I get the following error messages when executing:
O O contador da sessão session_oracle foi inicializado: 1
[1/12/05 8:39:17:734 BRST] 267c2e35 Helpers W NMSV0605W: A Reference object looked up from the context "localhost/nodes/localhost/servers/server1" with the name "jta/usertransaction" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ejs.jts.jta.UtxJNDIFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object
Exception data follows:
javax.naming.ConfigurationException
at com.ibm.ejs.jts.jta.UtxJNDIFactory.getObjectInstance(UtxJNDIFactory.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:884)
...
[1/12/05 8:39:18:000 BRST] 267c2e35 Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.jndicos.CNContextImpl
Context method: lookup
Context name: localhost/nodes/localhost/servers/server1
Target name: jta/usertransaction
Other data:
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is javax.naming.ConfigurationException
at com.ibm.ejs.jts.jta.UtxJNDIFactory.getObjectInstance(UtxJNDIFactory.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:884)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:1762)
....
[1/12/05 8:39:18:000 BRST] 267c2e35 JTATransactio E net.sf.hibernate.transaction.JTATransaction Could not find UserTransaction in JNDI
[1/12/05 8:39:18:016 BRST] 267c2e35 JTATransactio E net.sf.hibernate.transaction.JTATransaction TRAS0014I: The following exception was logged com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is javax.naming.ConfigurationException
at com.ibm.ejs.jts.jta.UtxJNDIFactory.getObjectInstance(UtxJNDIFactory.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:884)
...
I have tried changing the jta.UserTransaction property in the cfg configuration file but still it hasn´t worked. I tried:
- <property name="jta.UserTransaction">jta/usertransaction</property>
- <property name="jta.UserTransaction">UserTransaction</property>
- <property name="jta.UserTransaction">comp/UserTransaction</property>
So, can anyone please help me, show me a light at the end of the tunnel. I really need this help.
Thanks,
Carol