PermGen Space error when deploying tomcat 7?

99,167

Solution 1

More helpful solution is to increase values in JAVA_OPTS variable.
Add next line to your Catalina.bat/Catalina.sh file in bin directory

For Windows (Catalina.bat)

set JAVA_OPTS="-Xms1024m -Xmx10246m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m"  

For Unix (Catalina.sh)

export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=356m -XX:PermSize=256m -XX:MaxPermSize=356m"  

More solutions you can find in this article

Solution 2

Sometimes after re-deployments the Garbage Collector can't destroy some objects on Tomcat and run out of space. There are many reasons for these case:

  • If you use some CRUD-Objects - check if there are all closed after using.
  • If your app used other libs - sometimes the Objects from these libs cant also be destroyed, like MysqlConnector, Hibernate/C3p0 or other - try to put these libs on the tomcat/lib folder

Check the Tomcat with the "Java VisualVM" and check the permGen after re-deployment.
The default value for the permGen Space are often also very low you can increase them with the following javaVM parameter

 -XX:PermSize=64M -XX:MaxPermSize=256m

You can follow these tutorial

http://www.mkyong.com/tomcat/tomcat-javalangoutofmemoryerror-permgen-space/

UPDATE

other solution maybe found here : what to do with tomcat PermGen space

add -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC to the javaVM options

Solution 3

Tweak the value of the permgen using -XX:PermSize={value} and -XX:MaxPermSize={value} via the JAVA_OPTS variable where 'value' is a string like 256m.

Share:
99,167
Maharajan
Author by

Maharajan

Updated on July 05, 2022

Comments

  • Maharajan
    Maharajan almost 2 years

    I installed tomcat 7 to upgraded my JIRA projeect version from 5.0 to 6. After I place the project folder in tomcat's webapps. I run this localhost:8080/jira after long time running, it throws some error message. Please help us to fix this problem thanks in advance

    java.lang.RuntimeException: PermGen space
        at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
        at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66)
        at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1.execute(AsynchronousAbleEventDispatcher.java:32)
        at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:60)
        at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
        at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
        at com.atlassian.plugin.event.impl.DefaultPluginEventManager.broadcast(DefaultPluginEventManager.java:84)
        at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultPluginManager.java:768)
        at com.atlassian.plugin.manager.DefaultPluginManager.init(DefaultPluginManager.java:200)
        at com.atlassian.jira.plugin.JiraPluginManager.start(JiraPluginManager.java:63)
        at com.atlassian.jira.ComponentManager$PluginSystem.start(ComponentManager.java:635)
        at com.atlassian.jira.ComponentManager.startJIRA(ComponentManager.java:214)
        at com.atlassian.jira.ComponentManager.quickStart(ComponentManager.java:208)
        at com.atlassian.jira.ComponentManager.start(ComponentManager.java:193)
        at com.atlassian.jira.upgrade.PluginSystemLauncher.start(PluginSystemLauncher.java:23)
        at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:107)
        at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:323)
        at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:211)
        at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:100)
        at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:27)
        at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:66)
        at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33)
        at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:61)
        at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:657)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.OutOfMemoryError: PermGen space
    
  • Maharajan
    Maharajan about 11 years
    we set the CATALINA_OPTS = -Xms512m -Xmx1024m in Environment variable. And also increase the memory size in tomcat7w which is located in bin folder of tomcat 7. Please help me where I need to change the memory and how to get the result. thanks for the support :)
  • user18428
    user18428 about 11 years
    It's cleaner to set those exports in setenv.sh/.bat
  • Maharajan
    Maharajan about 11 years
    After follow the instruction as per the above site also it throws the same error. I am working on windows server. So I changed the values into catalina.bat file. so could u plz give me anyother way to overcome this? Note: I am working on windows server
  • Maharajan
    Maharajan about 11 years
    As per your instruction I was change the values in catalina.bat file. so could u plz give me any other way to overcome this?
  • Maharajan
    Maharajan about 11 years
    still i am getting ERROR: Bundle org.springframework.osgi.extender [7] EventDispatcher: Error during dispatch. (java.lang.OutOfMemoryError: PermGen space)
  • Maharajan
    Maharajan about 11 years
    still i am getting ERROR: Bundle org.springframework.osgi.extender [7] EventDispatcher: Error during dispatch. (java.lang.OutOfMemoryError: PermGen space)
  • Zelldon
    Zelldon about 11 years
    have you check the heap and permGen space from the tomcat after redeploy with JavaVisualVm? visualvm.java.net
  • Maharajan
    Maharajan about 11 years
    we are working in our local machine
  • Zelldon
    Zelldon about 11 years
    no problem... i work also on a local machine and found with java visual vm the problem
  • Zelldon
    Zelldon about 11 years
    i have a other solution maybee: -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC found here: stackoverflow.com/questions/10085028/…
  • Withheld
    Withheld over 10 years
    +1 for mentioning catalina.bat.