#.需要解决一下几个问题
#.1.不同的tomcat启动和关闭监听不同的端口#.2.不同的tomcat的启动文件startup.sh 中要指定各自的CATALINA_HOME和CATALINA_BASE这两个环境变量。.解决步骤:
修改/etc目录下的profile文件,添加一组java环境变量,和两组CATALINA环境变量;修改后的profile文件示例如下:
CATALINA_BASE_8088=/mnt/soft/tomcat/tomcat7-8088
CATALINA_HOME_8088=/mnt/soft/tomcat/tomcat7-8088export CATALINA_BASE_8088 CATALINA_HOME_8088TOMCAT_HOME_8088=/mnt/soft/tomcat/tomcat7-8088export TOMCAT_HOME_8088CATALINA_BASE_8086=/mnt/soft/tomcat/tomcat7-8086CATALINA_HOME_8086=/mnt/soft/tomcat/tomcat7-8086export CATALINA_BASE_8086 CATALINA_HOME_8086TOMCAT_HOME_8086=/mnt/soft/tomcat/tomcat7-8086export TOMCAT_HOME_8086修改server.xml配置和第一个不同的启动、关闭监听端口。修改后示例如下:
<Server port="8050" shutdown="SHUTDOWN"> 端口:8049->8050<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="9080" maxHttpHeaderSize="8192" 端口:8080->9080maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /><!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
8009 修改为别的值
修改[添加]bin下的startup.sh和shutdown.sh。修改后的示例如下:(同样的修改)
#export JAVA_HOME=/usr/java/jdk1.7.0_67
#export PATH=$PATH:$JAVA_HOME/bin#export CLASSPATH=$JAVA_HOME/lib#export CATALINA_HOME=$CATALINA_HOME_8086#export CATALINA_BASE=$CATALINA_BASE_8086
export JAVA_HOME=/usr/java/jdk1.7.0_71
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_HOME=$CATALINA_HOME_6082
4.修改完毕后,source /etc/profile。可能是因为修改了profile文件的缘故?
5.分别进入tomcat的bin目录,启动tomcat--./startup.sh