How to make sure that Tomcat6 reads CATALINA_OPTS on Windows?

后端 未结 4 1122
被撕碎了的回忆
被撕碎了的回忆 2021-02-03 14:48

I have a Tomcat6 running on a Windows2003 machine. I deployed 2 Grails apps on this server and I soon noticed that everything was crashing sometime after the deploy with a class

4条回答
  •  不知归路
    2021-02-03 15:14

    Look where you are setting it, use echo [statements] to troubleshoot, try setting it right before its passed to the VM, something like:

    set CATALINA_OPTS="-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
    _EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% 
    -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" 
    -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" 
    -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
    

    Make sure you have the right EXEC_JAVA not sure which version of the .bat file you have, but probably several if statements.

    Also make sure these are valid arguments for your VM.

    You can check your max heap size within your java code, use:

    long heapMaxSize = Runtime.getRuntime().maxMemory();
    

    Just print it out, if its correct based on your settings, you have a bad memory leak, if its not, then tomcat is not picking it up.

提交回复
热议问题