Hello,
I was using Hibernate 2.1.8 in a managed app on a OC4J 9.0.4.0.0 standalone Oracle app server and everything worked fine.
Now, We are migrating to OC4J 10.1.2.0.0 (standalone Oracle 10G app server) and I receive the following exception:
Code:
net.sf.hibernate.HibernateException: Could not locate TransactionManager
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:26)
at net.sf.hibernate.transaction.JTATransactionFactory.configure(JTATransactionFactory.java:48)
at net.sf.hibernate.transaction.TransactionFactoryFactory.buildTransactionFactory(TransactionFactoryFactory.java:48)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:77)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
at be.cm.comps.entitymanager.plugin.hibernate2.config.BaseHibernate2Config.buildFactory(BaseHibernate2Config.java:158)
at be.cm.comps.entitymanager.plugin.hibernate2.config.ManagedHibernate2Config.configureFactory(ManagedHibernate2Config.java:110)
at be.cm.comps.entitymanager.factory.Persistence.createEntityManagerFactory(Persistence.java:61)
at be.cm.comps.entitymanager.factory.Persistence.createEntityManagerFactory(Persistence.java:44)
at be.cm.apps.persistence.business.justif.ejb.impl.HibernatePatternTestBoBean.ejbCreate(HibernatePatternTestBoBean.java:45)
at HibernatePatternTestBoLocalHome_StatelessSessionHomeWrapper25.callCreate(HibernatePatternTestBoLocalHome_StatelessSessionHomeWrapper25.java:111)
at com.evermind.server.ejb.StatelessSessionEJBHome.getContextInstance(StatelessSessionEJBHome.java:271)
at com.evermind.server.ejb.StatelessSessionEJBHome.getLocalContextInstance(StatelessSessionEJBHome.java:166)
at HibernatePatternTestBoLocal_StatelessSessionBeanWrapper24.insertNewFashion(HibernatePatternTestBoLocal_StatelessSessionBeanWrapper24.java:71)
at be.cm.apps.persistence.workflow.ejb.impl.FacadeBean.test(FacadeBean.java:79)
at Facade_StatelessSessionBeanWrapper26.test(Facade_StatelessSessionBeanWrapper26.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Only session and message-driven beans with bean-managed transaction are allowed to use UserTransaction
at com.evermind.server.ApplicationContext.lookupJavaCompRsrc(ApplicationContext.java:180)
at com.evermind.server.ApplicationContext.lookupJavaComp(ApplicationContext.java:136)
at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:306)
at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
at javax.naming.InitialContext.lookup(Unknown Source)
at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransactionManager(JNDITransactionManagerLookup.java:23)
... 24 more
I think this is due to the net.sf.hibernate.transaction.OrionTransactionManagerLookup which I've specified as the 'hibernate.transaction.manager_lookup_class' because it specifies that the TransactionManager is located at JNDI namespace 'java:comp/UserTransaction' but I think this isn't the TransactionManager but just the UserTransaction (did Oracle change this?). Can this be possible?
Does anyone know how to fix this? I might write my own TransactionManagerLookupClass but I don't know where Oracle publishes the TransactionManager in 10G.
Is it possible they are just changing this to complicate the configuration and migration for us (Hibernate folks) because they have TopLink?
Thanx mates,
Stijn