Tomcat6 Support JTA with JOTM

jotm jars into tomcat6/lib

 

create a file named "carol.properties" in tomcat6/lib with following content:

 

carol.protocols=jrmp
carol.start.jndi=false
carol.start.ns=false
carol.jvm.rmi.local.call=false
carol.jndi.java.naming.factory.url.pkgs=org.apache.naming

3  modify tomcat's server.xml:

 

<Context docBase="workflow" path="/workflow" reloadable="true">
       <Resource
	      	name="oracle/call66"
	      	auth="Container"
	      	type="javax.sql.DataSource"
	        url="jdbc:oracle:thin:@IP地址:1521:数据库名"
	        driverClassName="oracle.jdbc.driver.OracleDriver"
	        username="erpsdb"
	        password="erps#66*call"
	        maxActive="50"
	        maxWait="10000"
	        factory="org.objectweb.jndi.DataSourceFactory"
	        poolPreparedStatements="true"
	        maxOpenPreparedStatements="100"
	        validationQuery="SELECT SYSDATE FROM DUAL" />
</Context>

 4  modify spring config:

 

<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>  
<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">  
        <property name="userTransaction" ref="jotm" />  
</bean>
<bean id="MyDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
	<property name="jndiName" value="java:comp/env/oracle/call66" />
</bean>

5  modify web.xml config:

 

<resource-ref>
	<description>DB Connection</description>
	<res-ref-name>oracle/call66</res-ref-name> 
	<res-type>javax.sql.DataSource</res-type>
	<res-auth>Container</res-auth>  
</resource-ref>

另:http://jotm.ow2.org/xwiki/bin/view/Main/WebHome

      http://docs.codehaus.org/display/BTM/Spring+Framework13


注:jtom支持分布式事务,多数据源事务,但是在网络断开或者db重起的情况下,不会自动重连。请看相关讨论http://old.nabble.com/Connection-Pool-Recovery-in-Bitronix---migrating-from-JOTM-td22953931.html

 

你可能感兴趣的:(spring,oracle,bean,workflow,SQL Server)