当前位置: 代码迷 >> Java Web开发 >> java.lang.OutOfMemoryError: Java heap space,该怎么解决
  详细解决方案

java.lang.OutOfMemoryError: Java heap space,该怎么解决

热度:810   发布时间:2016-04-17 10:24:36.0
java.lang.OutOfMemoryError: Java heap space
我的tomcat版本是1.6,jdk版本是1.6
都是安装版本的,运行了两个小型静态化网站,但是经常出现如下错误,平均每一两天重启一起tomcat
才能正常运行,网上的一些例子大部分都是1.5版本的,目录结构不一样,大多数也都是非安装版本的,我具体怎么
解决这个问题
Java code
2012-3-22 1:12:34 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet default threw exceptionjava.lang.OutOfMemoryError: Java heap space    at sun.text.UCompactIntArray.initPlane(Unknown Source)    at sun.text.UCompactIntArray.setElementAt(Unknown Source)    at java.text.RBTableBuilder.addOrder(Unknown Source)    at java.text.RBTableBuilder.addComposedChars(Unknown Source)    at java.text.RBTableBuilder.build(Unknown Source)    at java.text.RBCollationTables.<init>(Unknown Source)    at java.text.RuleBasedCollator.<init>(Unknown Source)    at java.text.Collator.getInstance(Unknown Source)    at freemarker.core.Environment.getCollator(Environment.java:736)    at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:165)    at freemarker.core.IfBlock.accept(IfBlock.java:80)    at freemarker.core.Environment.visit(Environment.java:209)    at freemarker.core.MixedContent.accept(MixedContent.java:92)    at freemarker.core.Environment.visit(Environment.java:209)    at freemarker.core.Environment.process(Environment.java:189)    at freemarker.template.Template.process(Template.java:237)    at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:187)    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.ponyjava.common.struts2.interceptor.UrlInterceptor.doIntercept(Unknown Source)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)    at org.apache.struts2.components.ActionComponent.executeAction(ActionComponent.java:289)    at org.apache.struts2.components.ActionComponent.end(ActionComponent.java:172)    at org.apache.struts2.views.freemarker.tags.CallbackWriter.afterBody(CallbackWriter.java:84)2012-3-22 3:08:37 org.apache.coyote.http11.Http11Protocol pause

我仔细查看了一个log
似乎还有这个报错信息
Assembly code
2012-3-21 10:17:40 freemarker.log.JDK14LoggerFactory$JDK14Logger error严重: Error reading included file WEB-INF/user_base/ybw_com_www/article_content/1/566_1.txtThe problematic instruction:----------==> include arti.relPath(pageNo) [on line 3, column 1 in WEB-INF/ftl_lib/jeecms/nonaction_article.ftl] in user-directive cms.ArtiContent [on line 22, column 23 in WEB-INF/user_base/ybw_com_www/template/article/default/content.html]----------Java backtrace for programmers:----------freemarker.template.TemplateException: Error reading included file WEB-INF/user_base/ybw_com_www/article_content/1/566_1.txt    at freemarker.core.Include.accept(Include.java:167)    at freemarker.core.Environment.visit(Environment.java:209)    at freemarker.core.Macro$Context.runMacro(Macro.java:168)    at freemarker.core.Environment.visit(Environment.java:602)    at freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)    at freemarker.core.Environment.visit(Environment.java:209)    at freemarker.core.MixedContent.accept(MixedContent.java:92)    at freemarker.core.Environment.visit(Environment.java:209)    at freemarker.core.Environment.process(Environment.java:189)    at freemarker.template.Template.process(Template.java:237)    at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:187)    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)    at com.opensymphony.xwork2.ActionChainResult.execute(ActionChainResult.java:222)    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)    at com.ponyjava.common.struts2.interceptor.UrlInterceptor.doIntercept(Unknown Source)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.jeecms.core.web.CookieIdentityInterceptor.doIntercept(Unknown Source)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.ponyjava.common.struts2.interceptor.DomainNameInterceptor.doIntercept(Unknown Source)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:532)    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)    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:286)    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)    at java.lang.Thread.run(Unknown Source)Caused by: java.io.FileNotFoundException: Template WEB-INF/user_base/ybw_com_www/article_content/1/566_1.txt not found.    at freemarker.template.Configuration.getTemplate(Configuration.java:489)    at freemarker.core.Environment.getTemplateForInclusion(Environment.java:1464)    at freemarker.core.Include.accept(Include.java:157)    ... 51 more2012-3-21 10:17:40 org.apache.catalina.core.StandardWrapperValve invoke
  相关解决方案