Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.OutOfMemoryError: PermGen space with tomcat7 windows service

i am running tomcat 7.0.33 on windows server 2008 R2 (i installed tomcat as windows service)

  • JDK version: jdk1.6.0_25 64-bit
  • Tomcat options:

    1. Java Virtual Machine: C:\Program Files\Java\jre6\bin\server\jvm.dll (BTW, i don't have client folder inside jre)
    2. Initial memory pool: 1000 MB
    3. Maximum memory pool: 2000 MB

      when i check the server status, i can see that the server is using the memory i configured.

    4. Environment Variables (SYSTEM VARIABLES) Configuration:

      • JAVA_HOME: C:\Program Files\Java\jdk1.6.0_25
      • Path: ...;%JAVA_HOME%\bin;....

do i need to add CATALINA_HOME and JAVA_OPTS system variables too ?

ISSUE: i have two web applications APP1,*APP2* when i deploy each one separately, i can find that memory use for

APP1= 198 MB APP2= 104 MB

Information about the applications:

APP1,APP2: Spring Maven applications that includes in the libraries other small maven spring applications.

APP1: contains webservices, that APP2 uses them.

if i tried to deploy both of them on same tomcat instance, i always get

java.lang.OutOfMemoryError: PermGen space

please advise what might be causing this issue.

like image 460
Mahmoud Saleh Avatar asked Nov 28 '22 17:11

Mahmoud Saleh


2 Answers

the solution was beside setting initial & maximum memory pool, is to add -XX:MaxPermSize=1000m to the java options in the java tab.

like image 163
Mahmoud Saleh Avatar answered Dec 09 '22 20:12

Mahmoud Saleh


You probably need to set/increase the MaxPermSize setting for your Tomcat instance. Note that the MAVEN_OPTS have nothing to do with Tomcat, those are options for the Maven command-line process (mvn). The fact that your application is a "maven" application means nothing at run-time as Maven is not involved in the running of your application, only the building of it.

In the \bin folder in your tomcat installation, there should be an application called "tomcat7.exe". You can use this to update the settings for your tomcat service.

Try something like

tomcat7.exe //US//[name of your tomcat service] --JvmOptions=-Xmx2g -Xms1g -XX:MaxPermSize=512m

Edit: above statement should be on one line, not two...

like image 33
pap Avatar answered Dec 09 '22 19:12

pap