1,下载tomcat5.5 在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. 然后把里面lib下的包全部导入,放到F:\apache-tomcat-5.5.34\common\lib下面,同时加入连接所用的jar包。
3、用附件里的ow_carol.jar来替换lib下的ow_carol.jar。因为JOTM自带的ow_carol.jar不支持jdk1.5下运行。我附件里的包是用jdk1.5编译过后的。可以正常使用。
4、在F:\apache-tomcat-5.5.34\common\classes下面加入配置文件carol.properties。内容如下。
# 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下的包全传上来吧。
?
?
?
?
?