`

java.lang.OutOfMemoryError: PermGen space maven

 
阅读更多

Error

Maven failed to build the project (or a list of projects) due to lack of resources problem as shown below.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project com.javacreed.examples.maven.error: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR]
[ERROR]
[ERROR] The system is out of resources.
[ERROR] Consult the following stack trace for details.
[ERROR] java.lang.OutOfMemoryError: PermGen space
[ERROR] at java.lang.ClassLoader.defineClass1(Native Method)
[ERROR] at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
[ERROR] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[ERROR] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[ERROR] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[ERROR] at org.codehaus.plexus.compiler.javac.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:56)
[ERROR] at com.sun.tools.javac.comp.MemberEnter.

 (MemberEnter.java:95)
[ERROR] at com.sun.tools.javac.comp.MemberEnter.instance(MemberEnter.java:85)
[ERROR] at com.sun.tools.javac.comp.Enter.
 
  (Enter.java:126)
[ERROR] at com.sun.tools.javac.comp.Enter.instance(Enter.java:114)
[ERROR] at com.sun.tools.javac.comp.Check.
  
   (Check.java:96)
[ERROR] at com.sun.tools.javac.comp.Check.instance(Check.java:86)
[ERROR] at com.sun.tools.javac.code.Types.
   
    (Types.java:101)
[ERROR] at com.sun.tools.javac.code.Types.instance(Types.java:88)
[ERROR] at com.sun.tools.javac.jvm.ClassReader.
    
     (ClassReader.java:264)
[ERROR] at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:226)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.
     
      (JavaCompiler.java:331)
[ERROR] at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:88)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:424)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:342)
[ERROR] at com.sun.tools.javac.main.Main.compile(Main.java:333)
[ERROR] at com.sun.tools.javac.Main.compile(Main.java:94)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:601)
[ERROR] at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:554)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

     
    
   
  
 

Solution

We need to increase the MaxPermSize ( Documentation ) to make sure that Maven has enough memory to compile all projects. Here is an article about Permanent Generation should you like to read more about this topic.

This can be achieved by setting the operating system environment variableMAVEN_OPTS and include the MaxPermSize setting as shown below.

MAVEN_OPTS

MAVEN_OPTS

MAVEN_OPTS 
-XX:MaxPermSize=128m

If you have a command prompt open, then you need to close it as the newly added environment variables will not be available. In order to make sure that the setting has effect, execute the following command to print the value of the environment variable.

C:\Users\Albert\javacreed >echo %MAVEN_OPTS%
-XX:MaxPermSize=128m

The echo command should print the value set to the MAVEN_OPTS environment variable.

分享到:
评论

相关推荐

    完美解决java.lang.OutOfMemoryError处理错误的问题

    - **解决方法**:Java 8之后,PermGen被Metaspace取代,处理方式类似。可以增加 Metaspace 的大小(`-XX:MaxMetaspaceSize`),或者限制加载的类数量,避免频繁加载新类。 在针对`OutofMemoryError`进行故障排查时...

    解决OutOfMemoryError内存溢出

    - PermGen Space是用于存储类元数据的空间,当系统中加载了过多的类且未被卸载时容易出现此类问题。 - 解决方案是增加PermGen Space的大小,可以通过设置`-XX:PermSize`和`-XX:MaxPermSize`来实现。 2. **Heap ...

    adminstore:一个简单的项目初始化模板,集成shiro,spring,hibernate,spring mvc,ehcache,disconver,bootstrap。搭建项目时候不错的一个选择!,后台采用AdminLte

    更低版本的JDK6、JDK7可能需要设置Java内存-XX:PermSize=128M -XX:MaxPermSize=512M,否则可能出现这种类型的内存溢出:java.lang.OutOfMemoryError: PermGen space。 Servlet2.5或更高版本(如Tomcat6或更高版本)...

    jspxcms:java 新闻发布系统

    更低版本的JDK7可能需要设置Java内存-XX:PermSize=128M -XX:MaxPermSize=512M,否则可能出现这种类型的内存溢出:java.lang.OutOfMemoryError: PermGen space。 Servlet3.0或更高版本(如Tomcat7或更高版本)。 ...

    后台管理系统

    更低版本的JDK6、JDK7可能需要设置Java内存-XX:PermSize=128M -XX:MaxPermSize=512M,否则可能出现这种类型的内存溢出:java.lang.OutOfMemoryError: PermGen space。 Servlet2.5或更高版本(如Tomcat6或更高版本)。...

    xmljava系统源码-cs_singlewindow_cms:统一门户CMS系统

    -XX:MaxPermSize=512M,否则可能出现这种类型的内存溢出:java.lang.OutOfMemoryError: PermGen space。 Servlet3.0或更高版本(如Tomcat7或更高版本)。 MySQL5.5或更高版本(如需使用MySQL5.0,可将mysql驱动版本...

    OpenDaylightController指南

    4. 常见运行问题:在运行OpenDaylight Controller过程中可能会遇到一些问题,例如,如果运行时出现内存溢出错误java.lang.OutOfMemoryError: PermGen space,可以通过设置环境变量MAVEN_OPTS为"-Xmx512m-XX:...

    javase源码-classloader-leak-prevention:ClassLoader泄漏预防/保护

    如果您想避免可怕的java.lang.OutOfMemoryError: Metaspace / PermGen space ,只需将此库包含到您的 Java EE 应用程序中,它就会处理剩下的事情! 要了解有关类加载器泄漏、其原因、类型、找到它们的方法和已知违规...

    Open Daylight Controller简易入门

    如果你遇到内存溢出错误(`java.lang.OutOfMemoryError: PermGen space`),可以通过修改Maven配置解决: ```bash export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m" ``` **3.3 使用Mininet测试** Mininet是一...

    jeecg常见问题

    java.lang.OutOfMemoryError: PermGen space ``` **解决方案**: 1. **增加JVM内存**:通过设置`-DMAVEN_OPTS`参数来调整JVM的内存分配。例如,可以通过以下命令行参数增加内存大小: ``` -DMAVEN_OPTS=-Xms1024...

    Linux部署Tomcat发布项目过程中各种问题及解决方法

    当Tomcat运行时出现`java.lang.OutOfMemoryError: PermGen space`,表明永久代内存不足。这可能是因为项目较大,加载的类较多。为解决这个问题,需要调整Tomcat的启动脚本`catalina.sh`,添加Java选项来增大内存分配...

Global site tag (gtag.js) - Google Analytics