注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

拥有自己的梦想,跟随心的召唤

平凡是福

 
 
 

日志

 
 

mvn jetty:run出现OutOfMemoryError: PermGen space的处理  

2012-05-07 11:26:14|  分类: Maven |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
在eclipse内使用 mvn jetty:run 出现OutOfMemoryError: PermGen space,异常堆栈如下:
2012-05-07 09:30:54.218:WARN:oejs.ServletHandler:Error for /bs/bc/template/loadTplConfigParam
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.getStackTrace(Throwable.java:582)
at org.codehaus.plexus.classworlds.realm.ClassRealm.findResource(ClassRealm.java:264)
at java.lang.ClassLoader.getResource(Unknown Source)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadResourceFromImport(ClassRealm.java:426)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.getResource(SelfFirstStrategy.java:60)
at org.codehaus.plexus.classworlds.realm.ClassRealm.findResource(ClassRealm.java:268)
at java.lang.ClassLoader.getResource(Unknown Source)
at org.eclipse.jetty.webapp.WebAppClassLoader.getResource(WebAppClassLoader.java:363)
at java.lang.Class.getResource(Unknown Source)
at freemarker.cache.ClassTemplateLoader.getURL(ClassTemplateLoader.java:143)
at freemarker.cache.URLTemplateLoader.findTemplateSource(URLTemplateLoader.java:75)
at freemarker.cache.MultiTemplateLoader.findTemplateSource(MultiTemplateLoader.java:111)
at freemarker.cache.TemplateCache.acquireTemplateSource(TemplateCache.java:600)
at freemarker.cache.TemplateCache.findTemplateSource(TemplateCache.java:576)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:347)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:235)
at freemarker.template.Configuration.getTemplate(Configuration.java:487)
at freemarker.template.Configuration.getTemplate(Configuration.java:452)
at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:735)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:506)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:477)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
2012-05-07 09:30:57.641:WARN:oeji.nio:handle failed
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.getStackTrace(Throwable.java:582)
at org.eclipse.jetty.util.log.StdErrLog.format(StdErrLog.java:547)
at org.eclipse.jetty.util.log.StdErrLog.format(StdErrLog.java:417)
at org.eclipse.jetty.util.log.StdErrLog.warn(StdErrLog.java:288)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:482)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
at java.lang.Thread.run(Unknown Source)

处理方法:
VM参数中添加如下配置:
-server -Xms256m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled -XX:+PrintGCDetails -Xloggc:%M2_HOME%/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%M2_HOME%/java_pid<pid>.hprof

其中参数说明如下:
-XX:+CMSPermGenSweepingEnabled : 允许permgenspace的垃圾回收
-XX:+CMSClassUnloadingEnabled : allows the garbage collector to remove even classes from the memory
-XX:PermSize=256M -XX:MaxPermSize=256M : raises the amount of memory allocated to the permgenspace
mvn jetty:run出现OutOfMemoryError: PermGen space的处理 - rongjih - 拥有自己的梦想,跟随心的召唤
 
试过在系统环境变量中添加 MAVEN_OPTS="-Xms40m -Xmx512m -XX:PermSize=512m" 不行,在eclipse.ini文件中添加 -Xms40m -Xmx512m -XX:PermSize=512m 也不行。

参考:
  评论这张
 
阅读(6033)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017