Tomcat deployment configuration as service

旧街凉风 提交于 2019-12-12 04:40:35

问题


I am currently investigating how to deploy Tomcat as a windows service with some configuration settings. Without using System Environment Variables, how can I specify the location of the JRE (I'm bundling it with my Tomcat distribution)? Also, how can I set the heap min and max sizes for Tomcat?

So far I've run the "service.bat" batch file with some added arguments like:

service.bat ServiceName //US//tomcat7 --JvmMs512–JvmMx1024

to attempt to set the heap sizes. This does not seem to be working.

EDIT: I've been using the following commands now that I understand them more:

tomcat7 //US//Test --JavaHome=PathToJRE --JvmMs=512 --JvmMx=1024

This still does not work. I'm verifying that it doesn't because I've uninstalled Java off of the host machine. Here is the location where I'm getting the information: http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html

It is my understanding that when deploying Tomcat as a service, "setenv.bat" and "setclasspath.bat" don't actually get executed. Please correct me if I am wrong, because that would be my easiest solution. Also what does get executed in terms of the batch files located inside tomcat/bin when you install Tomcat as a service using "service.bat" to do it?

-Thanks


回答1:


If you have used the archive setup of tomcat then you the file catalina.bat (tomcat\bin\catalina.bat) where you can add your extra configuration: SET JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m”

If you have installed tomcat using the installer provided for windows then you will not have this file. In this case you can use the tomcat7w.exe (also from tomcat\bin) where in the Java tab you can set up all that you want (this second option also works for the first case).



来源:https://stackoverflow.com/questions/21530484/tomcat-deployment-configuration-as-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!