Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PermGen Space error when deploying tomcat 7? [duplicate]

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
like image 884
Maharajan Avatar asked Mar 20 '13 12:03

Maharajan


People also ask

How do you fix a PermGen error?

To fix it, increase the PermGen memory settings by using the following Java VM options. -XX:PermSize<size> - Set initial PermGen Size. -XX:MaxPermSize<size> - Set the maximum PermGen Size. In the next step, we will show you how to set the VM options in Tomcat, under Windows and Linux environment.

How can I increase my PermGen size?

To increase PermGen, we have the following commands: -XX:PermSize=N - sets the initial (and minimum size) of the Permanent Generation space. -XX:MaxPermSize=N - sets the maximum size of the Permanent Generation space.

What causes PermGen space error?

lang. OutOfMemoryError: PermGen Space is a runtime error in Java which occurs when the permanent generation (PermGen) area in memory is exhausted. The PermGen area of the Java heap is used to store metadata such as class declarations, methods and object arrays.

How do I increase PermGen space in Weblogic?

To set PermGen size you can use e.g. -XX:PermSize=512m -XX:MaxPermSize=512m . Regarding Weblogic, set the JAVA_OPTIONS and see if these options are properly passed in as parameters into your Java process. You can also directly set these parameters in the startWeblogic.


2 Answers

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

like image 93
Ilya Avatar answered Oct 17 '22 17:10

Ilya


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

like image 28
Zelldon Avatar answered Oct 17 '22 17:10

Zelldon