Назад | Перейти на главную страницу

Tomcat снова и снова дает сбой из-за ошибки «Недостаточно памяти» "

Tomcat снова и снова дает сбой из-за ошибки «Недостаточно памяти». Я хотел знать точную причину увеличения использования памяти. Ниже приведены ошибки файла cataline.out.

Stack trace of tomcat when services shuted down
23 Nov 2010 11:57:04,171 ERROR (com.bcns.utils.Pagination:161) - Pagination.getPageLinks.Exception/ by zero

Stack trace of tomcat when heap space occured
14 Nov 2010 15:51:57,088 ERROR (apache.tiles.jsp.taglib.RenderTag:228) - IO Error executing tag: JSPException including path '/publics/layouts/header.jsp'.
org.apache.tiles.util.TilesIOException: JSPException including path '/publics/layouts/header.jsp'.      at org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:232)      at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105) at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96) at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61)      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103)  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:669)       at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337)       at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234)   at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211)   at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220)   at org.apache.jsp.publics.layouts.regionalhomepagelayout_jsp._jspx_meth_tiles_005finsertAttribute_005f0(regionalhomepagelayout_jsp.java:540)    at org.apache.jsp.publics.layouts.regionalhomepagelayout_jsp._jspService(regionalhomepagelayout_jsp.java:99)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)       at org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:241)     at org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:222)    at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)    at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103)  at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:669)       at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:689)       at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:643)       at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:626)       at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:322)       at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:104)   at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178)      at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348)      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)     at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)  at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)       at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)        at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)        at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)     at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)       at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)    at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)       at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)     at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)  at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)       at org.tuckey.web.filters.urlrewrite.RewrittenUrl.doRewrite(RewrittenUrl.java:176)      at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:758)       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)      at java.lang.Thread.run(Thread.java:619)Caused by: javax.servlet.ServletException: java.lang.OutOfMemoryError: Java heap space  at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)      at org.apache.jsp.publics.layouts.header_jsp._jspService(header_jsp.java:1901)  at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)        at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)     at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)       at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)      at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)        at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)  at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103) ... 151 moreCaused by: java.lang.OutOfMemoryError: Java heap space

Я хочу выяснить точную причину: это ошибка моего приложения или ОС, или мне действительно нужно больше памяти, так как я не обнаружил значительного увеличения средней нагрузки, использования ЦП, ввода-вывода диска и т. Д. Увеличивается только использование ОЗУ.

Любой, кто может предложить мне любой хороший инструмент мониторинга Java для решения этой проблемы, будет действительно признателен.

Попробуйте включить ведение журнала сборки мусора Java. Это даст вам хорошее представление о том, насколько быстро приложение использует память и насколько хорошо ее можно восстановить.

Вы можете обнаружить, что некоторая настройка параметров памяти Java решит проблему. Документация Sun включает хорошую документацию по настройке памяти. Ознакомьтесь с документацией Tomcat о некоторых типичных настройках памяти Java.