Maven Permgen Space Error
Contents |
here for a quick overview of
Increase Maven Memory
the site Help Center Detailed answers to any questions exception in thread "main" java.lang.outofmemoryerror: permgen space maven you might have Meta Discuss the workings and policies of this site About Us
Java.lang.outofmemoryerror Permgen Space Maven Eclipse
Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs set maven_opts command line Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up java.lang.OutOfMemoryError: PermGen space error [duplicate] up vote maven outofmemoryerror 6 down vote favorite 1 This question already has an answer here: Dealing with “java.lang.OutOfMemoryError: PermGen space” error 32 answers I've read all kind of solutions for this. A link in a comment in Dealing with “java.lang.OutOfMemoryError: PermGen space” error is the best I've found so far. Pretty complicated to follow though. The point is, I get this error just compiling a project with Maven. To my knowledge there is no aplication server so far. SO what's going on? And what can I do? This is my error: [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:02.743s [INFO] Finished at: Mon Sep 24 17:48:50 CEST 2012 [INFO] Final Memory: 77M/894M [INFO] ------------------------------------------------------------------------ --------------------------------------------------- constituent[0]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/aether-a pi-1.13.1.jar constituent[1]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/aether-c onnector-wagon-1.13.1.jar constituent[2]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/aether-i mpl-1.13.1.jar constituent[3]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/aether-s pi-1.13.1.jar constituent[4]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/aether-u til-1.13.1.jar constituent[5]: file:/C:/Program%20Files%20(x86)/apache-maven-3.0.4/lib/
Possible causes are: 1) Insufficient memory allocation for PermGen PermGen space keeps class definitions. Due to a fact that: Clover generates one helper class for every top-level class being instrumented and Clover adds extra
Exception In Thread "main" Java.lang.outofmemoryerror: Permgen Space Intellij
method call for every method, statement and branch in your original code maven gc overhead limit exceeded the memory requirement for PermGen space grows up. How much? It's roughly: for helper classes - 3kB * number
How To Set Maven_opts In Eclipse
of classes in your app for instrumented classes - 2 * original class size Therefore, doubling PermGen size is usually sufficient. 2) Memory leak in PermGen space This can happen http://stackoverflow.com/questions/12568658/java-lang-outofmemoryerror-permgen-space-error when you have a long running process (such us an application server) and you deploy multiple times a new version of an application into it (without restarting the process). It can happen that classes from old application will not be deallocated. See this article for more details: http://plumbr.eu/blog/what-is-a-permgen-leak. Resolution The required memory can be increased by setting the -XX:MaxPermSize setting on the https://confluence.atlassian.com/cloverkb/outofmemoryerror-permgen-space-424315810.html JVM. Add proper toggle for 'java' command call or set JAVA_OPTS, ANT_OPTS, MAVEN_OPTS depending on the build tool you use. Forking Processes It's important to note that some Maven plugins (such as Surefire or Failsafe) will fork the JVM process and MAVEN_OPTS may not take effect. If you are experiencing issues using Maven plugins even after you've set MAVEN_OPTS for your build, you will likely need to set the -XX:MaxPermSize setting in the respective plugin configurations. Example for maven-surefire-plugin
PermGen space Solution You must increase the Permanent Generation (PermGen) memory size of your JVM by passing the argument -XX:MaxPermSize and below how to perform it according to http://roufid.com/java-lang-outofmemoryerror-permgen-space-in-maven-build/ how you are executing the Maven build: Adding the environment variable MAVEN_OPTS Fix the problem on Eclipse Fix the problem in the pom.xml 1- Adding the environment variable MAVEN_OPTS The simplest way to https://myshittycode.com/2013/10/18/java-lang-outofmemoryerror-permgen-space-when-running-maven-on-intellij/ solve this problem is by adding the environment variable MAVEN_OPTS in which you will specify the PermGen size. MAVEN_OPTS is used to pass parameters to the Java VM when running Maven. On Windows permgen space Go to System properties -> Advanced system settings -> Advanced -> environment variable On the System variables section click on New… Fill the form with the following Variable name: MAVEN_OPTS Variable value: -XX:MaxPermSize=128m
Adding MAVEN_OPTS environment variable If you are using command line you can set the variable before running the build as following: 1 set MAVEN_OPTS=-XX:MaxPermSize=128m On Unix 1 export MAVEN_OPTS="-XX:MaxPermSize=128m" In this example exception in thread the JVM will allocate 128 MegaBytes for the PermGen. You can fit this value according to your need. 2- Running Maven in Eclipse If you are running Maven from your IDE you must create a new Run configuration with the necessary JVM Arguments. Below how to do: On your Eclipse IDE, Click on Run As… -> Run Configurations… Configure Maven on Eclipse - Run configurations… Double-click on Maven Build to create a new Maven Build Give a name to your Maven build to identify it On the base directory, type ${project_loc} to execute the build on the selected project On Goals, type the Maven goals you want to execute. For example clean install Configure Maven on Eclipse - Maven build And on the JRE tab, past the following text in the VM arguments section: 1 -XX:MaxPermSize=128m Configure Maven on Eclipse - JVM arguments Click Apply to save the build configuration Click Run to run the build on your project 3- Adding the configuration in the pom.xml Sometimes it’s very useful to create portable Maven builds that can be executed in different environments. The idea is to specify the PermGen size in the pom.xml of your prto illustrate my problem and solution here. PROBLEM I recently tried mixing some Groovy code into my existing JEE project. I created a simple POGO that looks as sophisticated as this:-
class GroovyStuff { String name }
Then, I configured one of my controllers to invoke that POGO:-
@Controller @RequestMapping(value = "/") public class HomeController { @RequestMapping(method = RequestMethod.GET) public String main() { GroovyStuff stuff = new GroovyStuff(); stuff.setName("Hello Groovy"); System.out.println(stuff.getName()); return "home"; } }
After starting up Jetty, I hit that controller from the web and I get this infamous exception:-
java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.findBootstrapClass(Native Method) at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:926) at java.lang.ClassLoader.loadClass(ClassLoader.java:297) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:407) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2475) at java.lang.Class.getDeclaredMethods(Class.java:1818) at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84) at java.security.AccessController.doPrivileged(Native Method) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81) at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79) at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46) at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33) at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250) at org.codehaus.groovy.runtime.m12n.SimpleExtensionModule.createMetaMethods(SimpleExtensionModule.java:111) at org.codehaus.groovy.runtime.m12n.SimpleExtensionModule.getMetaMethods(SimpleExtensionModule.java:93) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromProperties(MetaClassRegistryImpl.java:192) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromMetaInf(MetaClassRegistryImpl.java:174) at org.codehaus.gro