I am having problems with JOTM and Hibernate. I am getting a ClassCastException when opening a new session. My hibernate.cfg.xml contains this;
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<property name="hibernate.transaction.manager_lookup_class">
net.sf.hibernate.transaction.JOTMTransactionManagerLookup
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
I can successfully use the JDBCTransactionFactory without JOTM. I have also successfully used JOTM without Hibernate with the same context.xml (this is running inside tomcat).
When I do an openSession(), I get the exception below, caused by a ClassCastException.
Any help would be greatefully appreciated!
Hibernate version: 2.1.7c
Full stack trace of any exception that occurs:
net.sf.hibernate.HibernateException: Could not obtain JOTM transaction manager instance
at net.sf.hibernate.transaction.JOTMTransactionManagerLookup.getTransactionManager(JOTMTransactionManagerLookup.java:24)
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:1160)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:794)
at net.sf.cendil.test.SessionFactoryHolder.getSessionFactory(SessionFactoryHolder.java:19)
at net.sf.cendil.test.html.HomePage.pageBeginRender(HomePage.java:92)
at org.apache.tapestry.AbstractPage.firePageBeginRender(AbstractPage.java:463)
at org.apache.tapestry.AbstractPage.beginPageRender(AbstractPage.java:514)
at org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:433)
at org.apache.tapestry.form.Form.trigger(Form.java:582)
at org.apache.tapestry.engine.DirectService.service(DirectService.java:169)
at org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:872)
at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
at org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.hivemind.servlet.HiveMindFilter.doFilter(HiveMindFilter.java:136)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: org.objectweb.jotm.Current
at net.sf.hibernate.transaction.JOTMTransactionManagerLookup.getTransactionManager(JOTMTransactionManagerLookup.java:21)
... 34 more
Name and version of the database you are using: MySQL 4.1.7
|