Tomcat server does not start after JAVA_OPT change

Asked By 0 points N/A Posted on -


I am using Tomcat for my application development. I have deployed one web application. When I start the server the error mentioned below appears in the command prompt. The server does not start at all.

“java.lang.RuntimeException: Unable to create engine instance – class path be wrong, or contain invalid contents

Exception in thread "Low Memory Detector" java.lang.OutOfMemoryError: PermGen space”


Screen shot of the error message.

I have changed the JAVA_OPTs as follows;

set JAVA_OPTS=%JAVA_OPTS% -Xms64m -Xmx64m -XX:PermSize=32m -XX:MaxPermSize=32m

I cannot spare a lot of memory for this development application, so am trying to find the best RAM requirement for the server. I have the following two questions:

  1. What is the minimal RAM I need to put for a JVM in the Tomcat server?
  2. How do I measure the optimum for my application in Tomcat, so that I can put only the required amount in the JAVA_OPTs?



Answered By 0 points N/A #122437

Tomcat server does not start after JAVA_OPT change



Hi Uthpala,

First, you have to know that "java.lang.OutOfMemoryError: PermGen space" error is caused by your -XX:PermSize and -XX:MaxPermSize options. So for this error, you should increase the value of those options.

Fyi, -XX:PermSize and -XX:MaxPermSize are used to set PermGen space which are used for things that do not change (or change often) e.g. Java classes. So often large, complex apps will need lots of PermGen space. Also note that Xmx is separate from the PermGen space, so increasing Xmx will not help with the PermGen errors.

These are answers to your question:

  1. Tomcat itself can run with only 20-60 MB of memory. But you also need to consider the need of your app going to be deployed.
  2. Compare free memory of your server when the app is not running (peak usage) and when it's not running. Set the difference value as -Xmx. And for -XX:PermSize and -XX:MaxPermSize, put the difference between free memory when the app just starting and when it's not running. There are some ways to do this:

    • Using built-in feature of OS (e.g. free -m command in Linux);
    • Creating a jsp that print out result of java.lang.Runtime.getRuntime().freeMemory() and java.lang.Runtime.getRuntime().totalMemory();
    • Installing java-profiling tools (e.g. jProbe, Yourkit).

Hope it helps.

Login/Register to Answer

Related Questions