首页 > 代码库 > java.lang.OutOfMemoryError: Java heap space

java.lang.OutOfMemoryError: Java heap space

报错信息:

2014-11-17 10:22:51 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.OutOfMemoryError: Java heap space
at org.apache.xerces.dom.DeferredDocumentImpl.getNodeObject(Unknown Source)
at org.apache.xerces.dom.DeferredDocumentImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.DeferredElementNSImpl.synchronizeChildren(Unknown Source)
at org.apache.xerces.dom.ParentNode.getChildNodes(Unknown Source)
at org.apache.jasper.xmlparser.ParserUtils.convert(ParserUtils.java:164)
at org.apache.jasper.xmlparser.ParserUtils.convert(ParserUtils.java:179)
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:116)
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:133)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:222)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:181)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:386)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:450)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1397)
at org.apache.jasper.compiler.Parser.parse(Parser.java:130)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.eshore.sysmgr.util.LocalUserFilter.doFilter(LocalUserFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
[2014-11-17 10:23:00.275]-[DEBUG] java.sql.Connection {conn-100121} Connection
[2014-11-17 10:23:00.275]-[DEBUG] java.sql.Connection {conn-100121} Connection
[2014-11-17 10:23:00.275]-[DEBUG] java.sql.Connection {conn-100121} Preparing Statement: SELECT * FROM SCHEDULE_JOB A WHERE ( HOST = ?) AND ( STATUS = ?)
[2014-11-17 10:23:00.275]-[DEBUG] java.sql.Connection {conn-100121} Preparing Statement: SELECT * FROM SCHEDULE_JOB A WHERE ( HOST = ?) AND ( STATUS = ?)
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Executing Statement: SELECT * FROM SCHEDULE_JOB A WHERE ( HOST = ?) AND ( STATUS = ?)
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Executing Statement: SELECT * FROM SCHEDULE_JOB A WHERE ( HOST = ?) AND ( STATUS = ?)
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Parameters: [PC-20130106QSOB, 1]
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Parameters: [PC-20130106QSOB, 1]
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Types: [java.lang.String, java.lang.String]
[2014-11-17 10:23:00.291]-[DEBUG] java.sql.PreparedStatement {pstm-100122} Types: [java.lang.String, java.lang.String]

 

以下三种解决方法:

       1,从Intalled JREs里修改;window->Preferences->Java->Installed JREs,选择当前的JRE,然后edit它;在新窗口里设置Default VM Arguments为 -Xms128M -Xmx512M即可;这个设置应该对所有的工程都有效;

        2,如果仅仅是想对某个工程的有效的话,从Debug... 或Run...里修改,在(x)=Arguments里设置和上面相同的参数即可;

       3,如果小猫猫Tomcat的话,window->Preferences->Application Servers->Tomcat->Tomcat 6.x,选择JDK设置即可;

         大概就是这些设置,应该可以解决OutOfMemoryError: Java heap space的问题。

 

java.lang.OutOfMemoryError: Java heap space