关闭

增加tomcat jvm的虚拟内存

标签: tomcatjvmservletapachejdkjava
3596人阅读 评论(0) 收藏 举报
分类:

jdk1.6.0

tomcat6.0(安装版)

报错如下:

2012-3-22 1:12:34 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet default threw exception
java.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)

“可以找找看应用目录下面有没有生成 dump 文件,大小一般比你所配置JVM内存大小更大些。
然后用工具对dump文件进行分析,寻找数量多的可疑对象。——ldh911

解决中。。。

目前解决方案:

增加jvm的虚拟内存

由于tomcat是安装版本,于是采用修改注册表方法:

运行regedit

找到

Apache SoftWare Foundation/Prorun2.0/Tomcat6/Parameters/Options

双击Options->

-Dcatalina.home=D:\Tomcat 6.0
-Dcatalina.base=D:\Tomcat 6.0
-Djava.endorsed.dirs=D:\Tomcat 6.0\endorsed
-Djava.io.tmpdir=D:\Tomcat 6.0\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=D:\Tomcat 6.0\conf\logging.properties


在结尾添加

-Xms512m
-Xmx512m
然后重启tomcat进入

http://localhost:8080/manager/status

查看Free memory: 486.02 MB Total memory: 508.06 MB Max memory: 508.06 MB


3
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:531480次
    • 积分:5514
    • 等级:
    • 排名:第4796名
    • 原创:118篇
    • 转载:16篇
    • 译文:2篇
    • 评论:226条
    博客专栏
    我的地带
    我的微博
    最新评论