-
java.lang.OutOfMemoryError: Java heap space
Myeclipse里面部署的java web项目,浏览器访问的时候出现错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Filter execution threw an exception org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.dt.components.extable.filter.EXTableFilter.doFilter(EXTableFilter.java:151) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.dt.jframe.web.filters.SessionCheck.doFilter(SessionCheck.java:109)
root cause
java.lang.OutOfMemoryError: Java heap space
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
网上找了很多,都是说的jvm的内存不够用,网友提供的需要设置的地方如下:
1.可以在windows 更改系统环境变量
加上JAVA_OPTS=-Xms64m -Xmx512m2,如果用的tomcat,在windows下,可以在
C: omcat5.5.9incatalina.bat 中加上:
set JAVA_OPTS=-Xms64m -Xmx256m
位置在: rem Guess CATALINA_HOME if not defined 这行的下面加合适.
3.如果是linux系统
Linux 在{tomcat_home}/bin/catalina.sh的前面,加
set JAVA_OPTS='-Xms64 -Xmx512'但是上面的方法我都实验了,对我的这个问题没用,最后找到一个解决办法,我的问题解决了,解决方法如下:在Myeclipse里面设 置:Myeclipse->preferences->myeclipse->Application servers->tomcat->tomcat5.x->JDK面板中的Optional Java VM arguments中添加-Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxNewSize=512m -XX:MaxPermSize=256m -Djava.awt.headless=true -verbose:gc即可解决问题
这有一个连接地址,可以看一下详细的http://blog.csdn.net/bjd14/article/details/3896153