如何同时启动多个Tomcat服务

  在项目开发中,有时会需要同时启动多个Tomcat服务,如果直接启动多个的话,会报以下错误:

Port busy xxxx java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind,

这个就是端口被占用了,所以我们需要做的事就是改端口,首先到tomcat的conf文件夹下找到server.xml配置文件,需要改三个地方的端口:

1.修改http访问端口(默认为8080端口),比如改为8888

[html]  view plain copy
  1. <Connector   className="org.apache.coyote.tomcat4.CoyoteConnector"   port="8080"    
  2.                                minProcessors="5"   maxProcessors="75"     
  3.                                 enableLookups="true"   redirectPort="8443"     
  4.                                 acceptCount="100"   debug="0"   connectionTimeout="20000"     
  5.                                 useURIValidationHack="false"   disableUploadTimeout="true"   />   

2. 修改Shutdown端口(默认为8005端口),比如改为8006

[html]  view plain copy
  1. <Server port="8005" shutdown="SHUTDOWN" debug="0">  

3.修改JVM启动端口(默认为8009端口),比如改为8019

[html]  view plain copy
  1. < Connector    className ="org.apache.coyote.tomcat4.CoyoteConnector"      
  2.                                 port ="8009"    minProcessors ="5"    maxProcessors ="75"      
  3.                                 enableLookups ="true"    redirectPort ="8443"      
  4.                                 acceptCount ="10"    debug ="0"    connectionTimeout ="20000"     
  5.                                 useURIValidationHack ="false"      
  6.                                protocolHandlerClassName ="org.apache.jk.server.JkCoyoteHandler" />  


到此完成配置修改,重启Tomcat,ok。

你可能感兴趣的:(如何同时启动多个Tomcat服务)