Tomcat permGen space out of memory exception. Tomcat hangs and stops responding

為{幸葍}努か 提交于 2019-12-11 09:05:16

问题


I am using Spring, Struts, and Tomcat 7. After every few days I wake up to find out that the server has chocked Recently I checked all Hibernate sessions and made sure they are closed

To keep the question short, this is where Tomcat hangs:

java.lang.NullPointerException
    at com.x.x.a.PageActions.getUserPage(Unknown Source)
    at com.x.x.a.PageActions$$FastClassByCGLIB$$ac0e4af0.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    at com.x.x.a.PageActions$$EnhancerByCGLIB$$e7f27547.getUserPage(<generated>)
    at com.x.x.c.page.h.UsePageServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.x.x.FrontPageFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.x.x.Redirect301Filter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.x.x.SecureFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.x.x.LoginFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.x.x.StripJSessionFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception in thread "http-bio-80-exec-259" java.lang.OutOfMemoryError: PermGen space
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(Unknown Source)
    at sun.reflect.MethodAccessorGenerator.generateConstructor(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at java.util.ResourceBundle$Control.newBundle(Unknown Source)
    at java.util.ResourceBundle.loadBundle(Unknown Source)
    at java.util.ResourceBundle.findBundle(Unknown Source)
    at java.util.ResourceBundle.getBundleImpl(Unknown Source)
    at java.util.ResourceBundle.getBundle(Unknown Source)
    at sun.util.resources.LocaleData$1.run(Unknown Source)
    at sun.util.resources.LocaleData$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.util.resources.LocaleData.getBundle(Unknown Source)
    at sun.util.resources.LocaleData.getTimeZoneNames(Unknown Source)
    at sun.util.TimeZoneNameUtility.getBundle(Unknown Source)
    at sun.util.TimeZoneNameUtility.retrieveDisplayNames(Unknown Source)
    at java.util.TimeZone.getDisplayNames(Unknown Source)
    at java.util.TimeZone.getDisplayName(Unknown Source)
    at java.text.SimpleDateFormat.subFormat(Unknown Source)
    at java.text.SimpleDateFormat.format(Unknown Source)
    at java.text.SimpleDateFormat.format(Unknown Source)
    at java.text.DateFormat.format(Unknown Source)
    at org.apache.tomcat.util.http.FastHttpDateFormat.getCurrentDate(FastHttpDateFormat.java:114)
    at org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:1438)
Exception in thread "http-bio-80-exec-270" java.lang.OutOfMemoryError: PermGen space
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(Unknown Source)
    at sun.reflect.MethodAccessorGenerator.generateConstructor(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at java.util.ResourceBundle$Control.newBundle(Unknown Source)
    at java.util.ResourceBundle.loadBundle(Unknown Source)
    at java.util.ResourceBundle.findBundle(Unknown Source)
    at java.util.ResourceBundle.findBundle(Unknown Source)
    at java.util.ResourceBundle.getBundleImpl(Unknown Source)
    at java.util.ResourceBundle.getBundle(Unknown Source)
    at sun.util.resources.LocaleData$1.run(Unknown Source)
    at sun.util.resources.LocaleData$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.util.resources.LocaleData.getBundle(Unknown Source)
    at sun.util.resources.LocaleData.getLocaleNames(Unknown Source)
    at java.util.Locale.getDisplayString(Unknown Source)
    at java.util.Locale.getDisplayCountry(Unknown Source)
    at java.util.Locale.getDisplayCountry(Unknown Source)
    at com.x.x.web.MainBaseController.createUserAnonymousSession(Unknown Source)
    at com.x.x.c.web.MainBaseController.checkCookies(Unknown Source)
    at com.x.x.web.MainController.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
Exception in thread "http-bio-80-exec-272" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-80-exec-274" java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-80-exec-273" java.lang.OutOfMemoryError: PermGen space
... repeated a lot ...
Exception in thread "http-bio-80-exec-372" java.lang.OutOfMemoryError: PermGen space
java.lang.OutOfMemoryError: PermGen space

来源:https://stackoverflow.com/questions/16478894/tomcat-permgen-space-out-of-memory-exception-tomcat-hangs-and-stops-responding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!