隨筆-57  評論-202  文章-17  trackbacks-0

                最近把自己的IDE從JBuilderX升級到了2005,雖然在編輯Struts的配置文件的時候感覺快了些,但是總體還是很吃機器。以前的一些項目都是跑在Tomcat 4.0.6的環(huán)境下的,在2005中卻沒有了Tomcat 4.0的Server。為了讓開發(fā)環(huán)境和運行環(huán)境一致,我決定給2005加上Tomcat 4.0的Server。經(jīng)過一天的摸索,終于成功。
                一開始我以為用Configure Servers里面的Copy功能,把Tomcat 4.1的拷貝成4.0的就可以了,但是Tomcat跑不起來,因為4.1和4.0的server.xml文件的格式是不一樣的,在4.1中的server.xml文件格式如下:

           1<?xml version="1.0" encoding="UTF-8"?>
           2<!--This comment marks this file as generated, so it may be deleted and regenerated at any time. To preserve manual changes to this file, delete this comment.-->
           3<Server debug="0" port="8081" shutdown="SHUTDOWN">
           4  <Service name="Tomcat-Standalone">
           5    <Connector acceptCount="10" className="org.apache.coyote.tomcat4.CoyoteConnector" connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" port="8080" useURIValidationHack="false"/>
           6    <Engine debug="0" defaultHost="localhost" name="Standalone">
           7      <Host appBase="D:\jbproject\xxxxx\Tomcat\webapps" debug="0" name="localhost" unpackWARs="true"/>
           8    </Engine>
           9  </Service>
          10</Server>

          在4.0中的server.xml文件格式如下:

           1<?xml version="1.0" encoding="UTF-8"?>
           2<!--This comment marks this file as generated, so it may be deleted and regenerated at any time. To preserve manual changes to this file, delete this comment.-->
           3<Server debug="0" port="8081" shutdown="SHUTDOWN">
           4  <Service name="Tomcat-Standalone">
           5    <Connector acceptCount="10" className="org.apache.catalina.connector.http.HttpConnector" connectionTimeout="60000" debug="0" maxProcessors="75" minProcessors="5" port="8080"/>
           6    <Engine debug="0" defaultHost="localhost" name="Standalone">
           7      <Host appBase="D:\jbproject\xxxxx\Tomcat\webapps" debug="0" name="localhost" unpackWARs="true">
           8        <Context debug="0" docBase="D:\jbproject\xxxxx\admin" path="/admin" reloadable="true" workDir="D:\jbproject\xxxxx\Tomcat\work\admin"/>
           9      </Host>
          10    </Engine>
          11  </Service>
          12</Server>
          13

          在4.1中把具體的Context放到了webapps目錄下面,所以并不能簡單的copy過來就可以用。

                在JBuilder 2005中,每個Server都是以plugin的形式加入的,具體的jar文件放在lib目錄下面的servers目錄里面。用WinRAR打開tomcat-jbsp.jar文件,可以看到里面有Tomcat33*.class和Tomcat40*.class,也就是說其實JBuilder 2005其實是有這些server的配置信息的,只是它隱藏了。那么怎么把它打開呢?答案就在MANIFEST.MF文件里面,修改前的文件內(nèi)容如下:

          1Implementation-Vendor: Borland Software Corp.
          2Implementation-Version: 011.000.236.000
          3Implementation-Title: JBuilder 2005, English Edition
          4OpenTools-Servers: com.borland.jbuilder.server.tomcat.Tomcat50Server
          5  com.borland.jbuilder.server.tomcat.Tomcat41Server
          6

          在后面再增加一行:com.borland.jbuilder.server.tomcat.Tomcat40Server。保存,并且重啟JBuilder 2005,點擊Enterprise->Configure Servers,你將可以看到里面多了一個Tomcat4.0的Server。呵呵,大功告成!

                類似的還可以添加其它的Server,不過只限于JBuilder 2005本身有的Server。如果熟悉JBuilder 的plugin的大蝦完全可以自己編程解決。
          posted on 2005-05-12 11:56 小米 閱讀(511) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 东丰县| 隆安县| 德令哈市| 平南县| 柳州市| 屯留县| 镇巴县| 吉林省| 曲阜市| 潞西市| 剑河县| 宁河县| 兴和县| 林甸县| 汪清县| 金华市| 延庆县| 枣强县| 云龙县| 永州市| 兴安盟| 龙州县| 湖南省| 翁牛特旗| 周宁县| 芒康县| 辽中县| 叶城县| 安龙县| 门源| 钟山县| 临江市| 望城县| 鸡东县| 新干县| 西华县| 忻城县| 小金县| 西乌| 油尖旺区| 南京市|