51dev.com IT技术开发者社区

51dev.com 技术开发者社区

jetty 9.2 + java.lang.OutOfMemoryError: PermGen space 解决办法

代码星球阅读(13)2020-05-23 收藏0次评论


我这边的异常发生情况是生产环境   环境是 jetty 9.2   jdk7,


百度了很久没找到解决办法,搜到的倒是不少,不过都没什么鸟用,在Google翻到了,搬运一下。





java.lang.OutOfMemoryError: PermGen space
2018-03-08 18:06:58.428:WARN:oejs.HttpChannel:qtp1967670511-19: /wxapp/wxUser/order?code=011Q7slk2vtYzG08uRnk2vhllk2Q7slf&state=1 javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:130) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745)

 

 搬运工------------------------------》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》

In Jetty 9.2+

In your ${jetty.base} directory, add the jvm module + default configuration

[user]$ cd mybase
[mybase]$ java -jar /path/to/jetty-distribution/start.jar --add-to-start=jvm
INFO: jvm             initialised in ${jetty.base}/start.ini (appended)
[mybase]$ 
Now go edit your ${jetty.base}/start.ini and configure the properties, uncomment those things that you want (don't forge to uncomment --exec) jetty to use when starting itself up.

Example:

# --------------------------------------- 
# Module: jvm
--module=jvm
## JVM Configuration
## If JVM args are include in an ini file then --exec is needed
## to start a new JVM from start.jar with the extra args.
##
## If you wish to avoid an extra JVM running, place JVM args
## on the normal command line and do not use --exec
--exec
-Xmx1024m
-Xmn512m
-XX:MaxPermSize=128m
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
# -verbose:gc
# -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -XX:+PrintGCDetails
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -Dorg.apache.jasper.compiler.disablejsr199=true

 

以上就是jetty 9.2 + java.lang.OutOfMemoryError: PermGen space 解决办法的全部内容。