Tomcat6 部署两个项目后(两个均为S2SH),出现内存溢出,令人困扰

[size=x-large]硬件配置:
8G内存,四核CPU
软件平台:
windows2003+Tomcat6.20+Birt2.5+S2SH
JVM内存设置:
-Xms1536m
-Xmx2020m
引起的操作:
一般的查询不会报错,当利用birt查询报表时就会溢出(只要一执行,数据库中没有几条数据),两个项目中只有一个采用BIRT报表,另外一个应用就只是普通S2SH应用
birt获取数据采用:script脚本数据源:

获取数据:
[code="java"]
ft = new Packages.com.cargosys.birt.BirtFactory.getInstance();
delivers=ft.getDeliverView(params["startTime"].value,params["endTime"].value,params["code"]);
it=delivers.iterator();
return true;
[/code]

呈现数据:
[code="java"]
if(it.hasNext()==false){
return false;
}
var dmain=it.next();
row["mainId"]=dmain.getId();
row["mainCode"] = dmain.getCode();
row["createTime"] = dmain.getCreateTime();
row["carNumber"]= dmain.getCarNumberName();
row["sendFilialeName"]= dmain.getSendFilialeName();
row["receiveFilialeName"]= dmain.getReceiveFilialeName();
row["createUser"]=dmain.getCreateUserName();
row["driver"]= dmain.getDriver();
row["deliverCount"]=dmain.getTotalCount();
row["deliverWeight"]=dmain.getTotalWeight();
row["sosCar"]=dmain.getSosCar();
row["remark"]=dmain.getRemark();
return true;
[/code]

[/size]
[size=large][color=red]错误代码:[/color][/size]
2010-3-29 22:25:46 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:165)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java
:454)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext
.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
42)
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(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:488)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.service(AbstractBaseFragment.java:82)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.callBack(AbstractBaseFragment.java:106)
at org.apache.jsp.report_002dviewer.birt.pages.layout.ReportFragment_jsp
._jspService(ReportFragment_jsp.java:72)
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)
2010-3-29 22:25:50 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.getStackTrace(Throwable.java:582)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:155)
at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:135)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:678)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:488)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.service(AbstractBaseFragment.java:82)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.callBack(AbstractBaseFragment.java:106)
at org.apache.jsp.report_002dviewer.birt.pages.layout.FramesetFragment_j
sp._jspService(FramesetFragment_jsp.java:265)
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:3
42)
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(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:488)
at org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragm
ent.service(FramesetFragment.java:98)
at org.eclipse.birt.report.servlet.ViewerServlet.__doGet(ViewerServlet.j
ava:181)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPo
st(BirtSoapMessageDispatcherServlet.java:278)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.serv
ice(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
2010-3-29 22:25:50 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet ViewerServlet threw exception
java.lang.OutOfMemoryError: PermGen space
at java.lang.Throwable.getStackTraceElement(Native Method)
at java.lang.Throwable.getOurStackTrace(Throwable.java:591)
at java.lang.Throwable.getStackTrace(Throwable.java:582)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:155)
at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:135)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:678)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:488)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.service(AbstractBaseFragment.java:82)
at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment
.callBack(AbstractBaseFragment.java:106)
at org.apache.jsp.report_002dviewer.birt.pages.layout.FramesetFragment_j
sp._jspService(FramesetFragment_jsp.java:265)
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:3
42)
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(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationD
ispatcher.java:551)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDis
patcher.java:488)
at org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragm
ent.service(FramesetFragment.java:98)
at org.eclipse.birt.report.servlet.ViewerServlet.__doGet(ViewerServlet.j
ava:181)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPo
st(BirtSoapMessageDispatcherServlet.java:278)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.serv
ice(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)

单项目运行没有任何问题,数据量再大都不会出现溢出,添加多一个S2SH项目就会溢出,添加一个空的WEB应用,不会出现问题

5个回答

java.lang.OutOfMemoryError: PermGen space

他报的是这个错,

应该是说你的 PERM设置得太小

你看看你的这个参数是设置多大的
-XX:PermSize=128M
-XX:MaxPermSize=256m

建议你看看这几个链接

Tomcat内存溢出的三种情况及解决办法分析

[url]http://www.soidc.net/articles/1213781061058/20090818/1215945643607_1.html[/url]

分析java.lang.OutOfMemoryError: PermGen space
[url]http://www.iteye.com/topic/80620[/url]

你现在的TOMCAT 配置的XMS,XMX ,PERM SIZE是多大的?

可能原因有下:

1, log4j,最好不用,只用common-logging
2, 老版本的cglib,快点更新到最新版。
3, 更新到最新的hibernate3.2 3、

参考http://www.blogjava.net/GEF/archive/2009/03/28/262560.html

最好不用,用了出了问题也没办法哦。

原文地址应该是这位地
tomcat内存溢出总结
[url]http://www.blogjava.net/george/archive/2009/08/18/291579.html[/url]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐