日期:2014-05-19  浏览次数:20873 次

Tomcat+hibernate连接池配置
原来的部署环境是基于jboss的,现在由于种种原因,需要运行在tomcat上,总是报错。
Jboss环境下hibernate配置如下:
XML code

<hibernate-configuration>

<!-- jndi -->
<session-factory name="java:comp/env/hibernate/SessionFactory">
    <!-- properties -->
    <property name="connection.datasource">
        java:comp/env/jdbc/etc_portal
    </property>
    <property name="dialect">
        net.sf.hibernate.dialect.Oracle9Dialect
    </property>
    <property name="show_sql">false</property>
    <property name="use_outer_join">false</property>
    
    [b]<property name="transaction.manager_lookup_class">
        net.sf.hibernate.transaction.JBossTransactionManagerLookup
    </property>
    <property name="jta.UserTransaction">
        java:comp/UserTransaction
    </property>[/b]

    <!-- mapping files -->
</session-factory>

</hibernate-configuration>

运行在tomcat下报错信息:
HTML code
net.sf.hibernate.HibernateException: Could not locate TransactionManager
        at net.sf.hibernate.transaction.JNDITransactionManagerLookup.getTransact
ionManager(JNDITransactionManagerLookup.java:26)


应用中没有使用spring。在tomcat环境下,该如何配置
XML code
[b]<property name="transaction.manager_lookup_class">
        net.sf.hibernate.transaction.JBossTransactionManagerLookup
    </property>
    <property name="jta.UserTransaction">
        java:comp/UserTransaction
    </property>[/b]


本人在线,有需要提供的信息,我会及时补充,请不吝赐教。

------解决方案--------------------
tomcat不支持JTA吧