如何在JBuilder2005中新增Server

如何在JBuilder2005中新增Server

      最近把自己的IDE从JBuilderX升级到了2005,虽然在编辑Struts的配置文件的时候感觉快了些,但是总体还是很吃机器。以前的一些项目都是跑在Tomcat 4.0.6的环境下的,在2005中却没有了Tomcat 4.0的Server。为了让开发环境和运行环境一致,我决定给2005加上Tomcat 4.0的Server。经过一天的摸索,终于成功。
      一开始我以为用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文件里面,修改前的文件内容如下:

1 Implementation-Vendor: Borland Software Corp.
2 Implementation-Version: 011.000.236.000
3 Implementation-Title: JBuilder 2005, English Edition
4 OpenTools-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的大虾完全可以自己编程解决。

你可能感兴趣的:(如何在JBuilder2005中新增Server)