JAVA工程在TOMCAT里部署后(Struts构架),三个小时之内必出现这个异常,服务器的windows系统内存为:
Initial memory: 2046MB
Maximum memory: 4092MB请问各位高手们,为什么会出现下面的异常?急啊,困扰我一周了。。谢过了
type Exception report
message description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:682) org.apache.jsp.mpsview.production_005factual_005fshift_jsp._jspService(production_005factual_005fshift_jsp.java:1244) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause java.lang.OutOfMemoryErrornote The full stack trace of the root cause is available in the Tomcat logs. -------------------------------------------------------------------------------- Apache Tomcat/5.0.9
Initial memory: 2046MB
Maximum memory: 4092MB请问各位高手们,为什么会出现下面的异常?急啊,困扰我一周了。。谢过了
type Exception report
message description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:682) org.apache.jsp.mpsview.production_005factual_005fshift_jsp._jspService(production_005factual_005fshift_jsp.java:1244) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause java.lang.OutOfMemoryErrornote The full stack trace of the root cause is available in the Tomcat logs. -------------------------------------------------------------------------------- Apache Tomcat/5.0.9
解决方案 »
- 大家帮我看看,这句是什么意思,m,p, LEFT JOIN是什么意思(在线等,急)
- 新人求教
- 为何有的jar双击能打开,有的只能在cmd下运行?
- 怪哉,这样写文件拷贝为什么会出错
- 字符串如何转换成Calendar
- 在eclipse3.1中怎么将JDBC FOR MSSQL的驱动导入,我不会,请帮帮我
- 出错Java2D Direct3D usage disabled by J2D_D3D env怎么解决
- java做动态折线图
- 关于rmi注册的问题。。。。。。。。。。。。。。。。。。
- 请教高手--html页面中的表格数据直接存为excel文件格式
- java.lang.OutOfMemoryError 的问题
- java.lang.outofmemory 需要帮助!
因为内存溢出或没有可用的内存提供给垃圾回收器时,Java 虚拟机无法分配一个对象,这时抛出该异常。
上述为直接原因。可能由以下导致:
1,从现象来看程序里应该有大量的内存泄漏。即内存里存在了大量的有引用的对象但是实际确没有用到的对象,导致GC无法进行回收。
建议:在可以运行的3小时内采用专门的内存分析工具进行分析,分析的时候注意是否是在系统里做了某一特定操作后内存使用量剧增,以确定内存泄漏的大致地方;仔细检查代码是否有明显的内存泄漏。用-Xm1024的方法不赞同,我觉得应当把根源找出来。
-Xmn100M -Xms300M -Xmx300M运行时,在Eclipse中启动Tomcat,在javaw.exe内存使用量可以跑到100多M,可是直接打开Tomcat\bin的启动则不灵了。这又是怎么一回事了?另外,我使用的是Tomcat5.0,与JDK1.4.2,是不是它们的匹配不好的原因呢?该怎样设置服务器的JVM?
-----------------------
cownew开源团队,国内最活跃的开源团队之一,主要产品:sql翻译引擎、Hibernate建模工具,JDBC监控工具。
网址:http://www.cownew.com
blog:http://www.blogjava.net/huanzhugege
如果访问量比较大,把tomcat的内存设置更大。
言过其词了,在这里我是新人没错,但我不敢妄称"牛人"。
做开发真的挺不容易的呵,不过上了这条船就得进行到底了言归正传,程序中的代码都是数据库的查询与输出,用的是struts+javabean+jsp,在ApplicationContext.xml中:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">,这是不是意味着已经关闭掉连接池了?另,在命令行里测试:
System.out.println(Runtime.getRuntime().freeMemory());
System.out.println(Runtime.getRuntime().freeMemory());
发现结果输出仅为:
1901664
1901104因为之前我已经在Eclipse里面改动了VM的设置,最大值为300M,这又是怎么回事呢?真是头晕啊麻烦各位高手再帮偶分析一下好吗
比如数据库结果集,数据库连接
文件IO流
socket等等