afunms

My Software,My Dream—Forge a more perfect NMS product.

在Tomcat中集成jotm

1.下载ow2-jotm-dist-2.2.1

2.把jotm所有的jar放到Tomcat/lib下

3.创建文件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.nameing.factory.url.pkgs=org.apache.nameing

4.修改数据源配置文件
<?xml version='1.0' encoding='utf-8'?>
<Context path="/xflow" debug="0" reloadable="false" docBase="D:\workspace\xflow\WebRoot\">
   <Resource name="jdbc/afunms"
        auth="Container"
        type="javax.sql.DataSource"
        factory="org.objectweb.jotm.datasource.DataSourceFactory"
        driverClassName="com.mysql.jdbc.Driver"
        username="root"
  password="root"        
  url="jdbc:mysql://localhost:3306/netflow?useUnicode=true&amp;characterEncoding=utf-8" />
  <Resource name="UserTransaction"
            auth="Container"
            type="javax.transaction.UserTransaction" />
  <Transaction factory="org.objectweb.jotm.UserTransactionFactory"
               jotm.timeout="60" />
</Context>

5.java代码这样写:
  Context ctx = new InitialContext();
  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/afunms");
  UserTransaction ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");

posted on 2011-08-29 16:38 afunms 阅读(627) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

News

留言簿(18)

随笔档案

相册

搜索

最新评论

阅读排行榜