eclipse for javaEE中发布web到tomcat

来源:互联网 发布:scala java 编辑:程序博客网 时间:2024/05/28 04:53

http://www.myexception.cn/web/925372.html

eclipse ee中发布web到tomcat

用eclipse ee发布web到tomcat下,下面是我的实践:

1. 清空tomcat server上的应用,这样才可以修改tomcat server的配置。

2. 双击tomcat server,打开配置页面如下图:

3. 修改Server Locations(或者是Server path), 默认是放在工程的setting中,现修改到tomcat中的webapps中,要先清楚掉所有server上的app才可以编辑,选择第二项 Use Tomcat Installation, 然后 Deploy Path字段填写webapps. 后面的似乎都是可以不要的

4. 在Publishing中选择第二项:Automatically publish when resources changes. 并且Update Context Paths复选框勾掉,不要选择。

5. Server Options: 勾选上第二项和第三项。Publish module Context into a seprate xml file, 这样会在 tomcat-7.0.23(X64)\conf\Catalina\localhost 下面生成一个单独的以web的context为名称的xml文件,例如:wbxapi.xml,其中的配置是一个Context配置,例如:

<Context antiJARLocking="true" docBase="webexapi" path="/webexapi" reloadable="true" source="org.eclipse.jst.j2ee.server:webexapi">   <Resource auth="Container" connectionProperties="streamstolob=true" driverClassName="com.inet.ora.OraDriver" initialSize="10" logAbandoned="true" maxActive="30" maxIdle="10" maxWait="10000" name="jdbc/***" password="***" removeAbandoned="true" removeAbandonedTimeout="60" testOnBorrow="true" timeBetweenEvictionRunsMillis="300000" type="javax.sql.DataSource" url="jdbc:inetora:your ip:port:schema" username="***" validationQuery="SELECT instance_name FROM v$instance"/></Context>

注意如果想要生成jndi的Resource配置,需要下面一步的配置,否则只会生成Context的上下文。

6. 配置系统中用到的jndi datasource. 在工程中的 META-INF 文件夹下建立context.xml文件,里面内容是jndi的配置。例如: <Context path="/webexapi" docBase="webexapi" antiJARLocking="true">

   <Resource name="jdbc/webexapi" .......

eclipse在发布的时候会自动把其中内容重新copy到tomcat下的一个单独文件中。见第5步


原创粉丝点击