caiwen

 
 

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与

留言簿(3)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔档案

  • 2007年4月 (1)
  • 2006年12月 (1)

文章分类

  • java (rss)
  • js(1) (rss)
  • 服务器(3) (rss)

文章档案

  • 2007年1月 (4)

java学习链接

  • IBM文档库
  • IBM文档库

搜索

  •  

最新评论

阅读排行榜

  • 1. tomcat的Context配置(34945)
  • 2. 哈哈,今天我的blog开通了(354)

评论排行榜

  • 1. tomcat的Context配置(0)
  • 2. 哈哈,今天我的blog开通了(0)

Powered by: 博客园
模板提供:沪江博客
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

2006年12月29日

tomcat的Context配置

今天终于搞定Tomcat的Context了,conf/Context.xml是Tomcat公用的环境配置;若在Server.xml中增加<Context path="/test" docBase="D:\test" debug="0" reloadable="false"/>的话,则myApp/META-INF/Context.xml就没用了(被server.xml中的Context替代),Jndi 数据源或其他资源可直接定在里面,如: 
    <Context path="/frame" docBase="C:\Java\jboss-4.0.1sp1\server\default\deploy\webroot.war" debug="0" reloadable="false">
      <Resource name="UserTransaction" auth="Container"
                                            type="javax.transaction.UserTransaction"
                                            factory="org.objectweb.jotm.UserTransactionFactory"
                                            jotm.timeout="60" />     
      <Resource name="sharkdb" type="javax.sql.DataSource"                                     
                                      password="helloworld" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
                                      maxIdle="2" maxWait="5000" username="sa"
                                      url="jdbc:microsoft:sqlserver://192.168.0.193:1433;DatabaseName=test_cyber3;SelectMethod=cursor" maxActive="4"/>
                                     
     <Resource name="cyberwaydb" type="javax.sql.DataSource"                                     
                                      password="helloworld" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
                                      maxIdle="2" maxWait="5000" username="sa"
                                      url="jdbc:microsoft:sqlserver://192.168.0.193:1433;DatabaseName=test_cyber3" maxActive="4"/>
      
      </Context>;
若在<GlobalNamingResources>中增加的JNDI或其他的,在App中需引用,才能使用,以下两种引用方式:
  A:在WEB-INF/web.xml 中配置如下:
<resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/TestDB</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
B:在yoursApp\META-INF\context.xml, 如下:
<?xml version='1.0' encoding='utf-8'?>
<Context path="/yoursApp" docBase="yoursApp"
debug="5"  
reloadable="true"
crossContext="true">
<ResourceLink name="mysqlDBConPool" global="mysqlDBConPool" type="javax.sql.DataSource"/>

</Context>

posted @ 2007-04-03 15:31 cloud 阅读(34945) | 评论 (0) | 编辑 收藏
 
哈哈,今天我的blog开通了

大家好,我的Blog今天开通了,

posted @ 2006-12-29 12:38 cloud 阅读(354) | 评论 (0) | 编辑 收藏