• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

HIbernate 3 + Tomcat 5.5.7 + JOTM

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone successfully managed to get hibernate running with tomcat and using JOTM. I've followed a few examples and am using the HibernateUtil example from the CaveatEmptor example. In my application I get a begin a transaction by calling HibernateUtil.getSeesionFactory().getCurrentSession().beginTransactionI() but this always fails giving me a "org.hibernate.HibernateException: No TransactionManagerLookup specified" exception.

My hibernate.cfg.xml file is:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="connection.datasource">java:comp/env/jdbc/wikidsistas</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.JOTMTransactionManagerLookup
</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>

<!-- Mapping files -->
<mapping resource="Customer.hbm.xml"/>

</session-factory>

</hibernate-configuration>


and my tomcat context.xml file is:

<Context path="/wikidsistas" docBase="wikidsistas">
<Resource name="jdbc/wikidsistas" auth="Container"
type="javax.sql.DataSource"
username="user"
password="secret"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/wikidsistas"
maxActive="15" maxIdle="2"
maxWait="10000"/>

<ResourceLink name="jdbc/tomcatusers"
global="jdbc/tomcatusers"
type="javax.sql.DataSource"/>

<Resource name="UserTransaction" auth="Container"
type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory"
jotm.timeout="60"/>
<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>

</Context>

Strange thing is, calls to HibernateUtil.getConfiguration().getProperty(Environment.TRANSACTION_MANAGER_STRATEGY)) tells me that the strategy is "org.hibernate.transaction.JOTMTransactionManagerLookup"

I'm baffled.
 
craig a chapman
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I never did solve this with JOTM. I ended up integrating Spring and made use of it's Hibernate and Transaction Management support. Very worthwhile.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic