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.