windows server 2008开机启动多个tomcat服务方法及遇到问题

需求:

windows server 2008部署多个tomcat应用,且要求开机自启动

  • 1.部署多个tomcat实例可以使用CATALINA_BASE

  CATALINA_BASE目录下必须包含conf、logs、temp、webapps和work. 

1 set CATALINA_BASE=C:\cas\tomcatInstance\cas
2 set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
3 "%EXECUTABLE%" run

  每个应用单独写一个startup.bat

set CATALINA_BASE=C:\cas\tomcatInstance\cas
set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat
"%EXECUTABLE%" run
  • 2.写个集成启动多个startup.bat的bat 
@echo on 1>nul 2>nul 3>C:\cas\tomcatInstance\start_up_plan.log>&3
start C:\cas\tomcatInstance\cas\startup.bat
  • 3.在开机启动目录新增开机启动文件vbs

  目录:C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

set ws=WScript.CreateObject("WScript.Shell")
ws.Run "C:\cas\tomcatInstance\start_up_plan.bat",0
  • 4.设置tomcat系统变量

  CATALINA_HOME: C:\cas\apache-tomcat-8.0.24


 

遇到问题及解决:

执行脚本后会弹出命令窗口,此时访问tomcat项目正常,一旦关闭就会kill掉tomcat进程.

解决方法:

修改%CATALINA_HOME%\bin\setclasspath.bat

默认::

set _RUNJAVA="%JRE_HOME%\bin\java.exe"

修改为:

set _RUNJAVA="%JRE_HOME%\bin\javaw.exe"
posted @ 2019-08-20 15:53  爱笑的狐狸  阅读(633)  评论(0编辑  收藏  举报