vicker313 tech blog

October 3, 2010

How to adjust Tomcat Reserved Memory

Filed under: Tomcat — Tags: , , , — vicker313 @ 8:37 am

By default, Tomcat Service is running under memory limit to 64MB. Java Memory Heap Exception might occur if the application has no enough memory to use. To increase or adjust the memory limit in Tomcat Service, simply edit $TOMCAT/bin/catalina.bat (or catalina.sh in Linux) and look for JAVA_OPTS:

set JAVA_OPTS = ""

Add in -Xms128m -Xmx256m to JAVA_OPTS. Xms is the initial memory when Tomcat is run while Xmx is the maximum memory that Tomcat can use.

set JAVA_OPTS = "-Xms128m -Xmx256m"

How to set Unlimited Session Timeout in Tomcat

Filed under: Tomcat — Tags: , , — vicker313 @ 8:25 am

Session Timeout in Tomcat is set at web.xml, either at Server Level ($TOMCAT/config/web.xml) or Web App Level ($TOMCAT/webapps/yourwebapp/WEB-INF/web.xml). Look for the following tag (or add in):

<session-config>
<session-timeout>60</session-timeout>
</session-config>

The number in session-timeout tag is in minutes. To make it unlimited or no time out, simply set the number to -1 and restart your Tomcat Service.

<session-config>
<session-timeout>-1</session-timeout>
</session-config>

Create a free website or blog at WordPress.com.