Pergunta

I received OutOfMemoryError: PermGen space error.
I run tomcat using command:

/usr/local/etc/rc.d/tomcat7 start

I am trying to increase PermGen space (JAVA_OPTS="-XX:PermSize=256m -XX:MaxPermSize=256m").

I tried to add this string to next places:

catalina.sh
startup.sh
setenv.sh
tomcat7(/usr/local/etc/rc.d/)

But it is no effect. Default Tomcat server status (/manager/status) shows that only 82MB allowed for PS Perm Gen.

What I did wrong?

OS Name: FreeBSD
OS Version: 9.1-STABLE
# java -version
openjdk version "1.7.0_21"
OpenJDK Runtime Environment (build 1.7.0_21-b11)
OpenJDK 64-Bit Server VM (build 23.21-b01, mixed mode)
Foi útil?

Solução

What helped me: In the tomcat7(/usr/local/etc/rc.d/):

tomcat7_java_opts="-XX:PermSize=256m -XX:MaxPermSize=256m"

Outras dicas

I suspect that the server process on the machine is not picking up right Java OPTS. Please try to find the process on the server and check the parameters being passed.

In Linux, its usually be

ps -ef | grep tomcat
or ps -ef | grep java

to find out the process and verify the JVM parameters.

Edit 1: the is a sample output of the command to find process, which might indicate the java opt parameter values:

    local-vm-1 [5]:ps -ef | grep tomcat


tomcat    4141     1  0 07:38 ?        00:01:33 /apps/mw/jdk/1.6.0.17-64bit/bin/java -Dnop -Xms1024m -Xmx1024m -server -DTC=testplatform -DWMC_ENV
=test -XX:MaxNewSize=112m -XX:NewSize=112m -XX:SurvivorRatio=6 -XX:PermSize=256m -XX:MaxPermSize=256m -Dsun.net.inetaddr.ttl=0 -DLISTEN_ADDRESS=wsx
-test-vm-dtcp-1.managed.com -Djavax.net.ssl.trustStore=/tech/tomcat/props/ldapstore.ts -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxre
mote.host=wsx-test-vm-dtcp-1 -Dcom.sun.management.jmxremote.port=25000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.auth
enticate=true -Dcom.sun.management.jmxremote.password.file=/tech/tomcat/props/jr-password.properties -Dcom.sun.management.jmxremote.access.file=/tec
h/tomcat/props/jr-access.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/tech/tomcat/apache-tomca
t-7.0.16/endorsed -classpath /tech/tomcat/apache-tomcat-7.0.16/bin/bootstrap.jar:/tech/tomcat/apache-tomcat-7.0.16/bin/tomcat-juli.jar -Dcatalina.ba
se=/tech/tomcat/instances/testplatform -Dcatalina.home=/tech/tomcat/apache-tomcat-7.0.16 -Djava.io.tmpdir=/tech/tomcat/instances/testplatform/te
mp org.apache.catalina.startup.Bootstrap start
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top