Eclipse部署多个Web项目内存溢出,java.lang.OutOfMemoryError: PermGen space
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
蕃薯耀 2016年9月20日 10:22:56 星期二
http://fanshuyao.iteye.com/
一、问题描述
在Eclipse中启动Tomcat(部署2个项目时),访问时,出现java.lang.OutOfMemoryError: PermGen space
原因就是内存溢出,因为Tomcat本身默认的内存是比较小的,如果部署多个项目,内存就不够用了,因为需要把内存修改得大点。
错误信息如下:
2016-9-20 10:25:21 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet [spring] in context with path [/businesshall] threw exception [Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space] with root causejava.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.apache.jasper.compiler.ParserController.getPageEncodingForJspSyntax(ParserController.java:479) at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:420) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:190) at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:119) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:194) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
二、解决方案
1、在Eclipse点击Tomcat打开配置页面,如下图所示:
2、点击open launch configuration
3、进入Arguments标签项
4、配置VM Arguments,加入内存的相关配置,如下图所示:
-Xms512m -Xmx1024m-XX:PermSize=512M -XX:MaxPermSize=1024M
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
蕃薯耀 2016年9月20日 10:22:56 星期二
http://fanshuyao.iteye.com/