1,从官网上下载tomcat5.5,在tomcat下的conf/contenxt.xml中配置以下参数。
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
<Resource name="zhang/jta1"
auth="Container"
type="javax.sql.DataSource"
factory="org.objectweb.jndi.DataSourceFactory"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/jta2?autoReconnect=true"
maxActive="30" maxIdle="30"/>
<Resource name="zhang/jta2"
auth="Container"
type="javax.sql.DataSource"
factory="org.objectweb.jndi.DataSourceFactory"
username="root"
password="123"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/jta1?autoReconnect=true"
maxActive="30" maxIdle="30"/>
<Resource name="UserTransaction" auth="Container"
type="javax.transaction.UserTransaction"
factory = "org.objectweb.jotm.UserTransactionFactory"
jotm.timeout = "60"/>
<!--<Transaction factory="org.objectweb.jotm.UserTransactionFactory"
jotm.timeout="60"/>-->
</Context>
2、从网上下载JOTM 2.10. 然后把jotm-2.0.10\lib下的包全部导入到F:\apache-tomcat-5.5.34\common\lib下面,同时加入数据库连接时所需要的jar包。
3、用下面附件里的ow_carol.jar来替换F:\apache-tomcat-5.5.34\common\lib下刚加入的ow_carol.jar。因为从JOTM\lib下导入的ow_carol.jar不支持jdk5.0下运行。我附件里的ow_carol.jar是对ow_carol源码用jdk1.5编译重新生成的。可以在JDK5.0下正常使用。
4、在F:\apache-tomcat-5.5.34\common\classes下面加入配置文件carol.properties。内容如下。这样JOTM将不会使用CAROL JNDI wrapper,从而可以避免类装载错误的发生。
# JNDI (Protocol Invocation)
carol.protocols=jrmp
# Local RMI Invocation
carol.jvm.rmi.local.call=true
# do not use CAROL JNDI wrapper
carol.start.jndi=false
# do not start a name server
carol.start.ns=false
# Naming Factory
carol.jndi.java.naming.factory.url.pkgs=org.apache.naming
5、项目中所有的配置都在下面附件中,具体内容可下载查看。
6、我在运行这个项目时在tomcat的lib下已经加入了jotm.jar,但是还是有问题。一直报错。后来我把jotm.jar在项目的webapp下的lib下面再加一份就正常了。可能是因为tomcat下加载时没有正常加载jotm包。
7,用的是mysql数据库。
8 我把tomcat下的apache-tomcat-5.5.34\common\lib下的包全传上来吧。
分享到:
相关推荐
struts + spring + hibernate + velocity + ajax + jotm + acegi
2.Spring+Jotm整合实现JTA分布式事务,应用场景如转账等,同一事务内完成db1用户加100元、db2用户减100元。 3.Spring+Junit4单元测试,优点:不会破坏数据库现场,等等。 (特别注意:Spring3.0里不在提供对jotm的...
Spring+iBatis+JOTM实现JTA事务 spring ibatis jotm 分布 事务 多数据源
spring+jotm 多数据源事务管理(三)JNDI+Tomcat 首先需要将jotm相关jar包加入到tomcat中,如下: o jotm.jar o jotm_jrmp_stubs.jar o ow_carol.jar o jta.jar o jta-spec1_0_1.jar o jts1_0.jar o objectweb-...
Java分布式开发spring+jta+jotm,可用 Java分布式开发spring+jta+jotm,可用
Tomcat+spring+hibernate+jotm,还有就是struts、Oracle等 二、需求说明 系统里有2套不同网域的oracle数据库,之间的数据需要进行交互。 三、Dao配置 1、定义jtom Bean xml 代码 1. <bean id="jotm" class="org....
NULL 博文链接:https://liangzhijian.iteye.com/blog/1404534
代码下载下来,想要了解更多相关内容可以看http://www.cnblogs.com/shamo89/p/7307961.html
spring + JTA + JOTM实现分布式事务, 高大上的技术
1 通过集成JOTM,直接在Spring中使用JTA事务 1.1. 将JOTM以下类库添加到类路径中 1.2. 编写JOTM配置文件,放到类路径下 1.3. 在MySQL上建立两个数据库 1.4. 在Spring配置文件中配置JOTM 1.5. 在Spring中运行测试 2 ...
NULL 博文链接:https://zhaoshijie.iteye.com/blog/1836707
NULL 博文链接:https://81365341.iteye.com/blog/763418
spring+jotm 多数据源事务管理(二)hibernate 使用hibernate关联jotm也很方便,先看一个没有使用jotm的例子:
多数据源 更新 spring jta java jotm
Spring+iBatis+JOTM实现JTA事务: 如何处理跨库事物:spring + jtom 的jta事务是个很好的选择. 这个源码示例非常不错,包括所有的源码和jar包,下载后eclipse 或 myeclipse 导入就能用。 里面有详细的说明和注释,...