を取得していますが、java.lang.OutOfMemoryError: Java heap space
それを回避する方法がわかりません。基本的にソケットバッファーだと思っていたものに書き込んでいます。だと思いますjavax.servlet.jsp.JspWriter
。
ただし、非常に大きな HTML ファイル (最大 700,000 行) を書き込もうとすると、java.lang.OutOfMemoryError: Java heap space
. フレームワークがソケットにフラッシュしない理由を混乱させました。(マーシャ、マーシャ、マーシャ) 冗談はさておき、バッファを大きくするだけでなく、ソケットにフラッシュすることはできますか?
JSF 1.1 を使用しています。
注、私はこの web.xml を追加しようとしました:
<context-param>
<param-name>facelets.BUFFER_SIZE</param-name>
<param-value>500000</param-value>
</context-param>
何も変わっていないように見えました。
ここに私のコードサンプルがあります:
<html>
<f:view>
<head>
<title>Test</title>
</head>
<body id="page_body"
<h:form id="form">
<%
String s;
for (int i = 0; i < rowCount; i++) {
s = data.get(i);
out.println(s);
//flush after on every thousandths row.
//if(i%1000==1)
// out.flush();
} // for loop
%>
</h:form>
</body>
</f:view>
</html>
これが私が得る例外です:
org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.OutOfMemoryError: Java heap space
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
test.CustomLocaleRemapViewHandler.renderView(CustomLocaleRemapViewHandler.java:94)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
test.CustomFilter.doFilter(CustomFilter.java:46)
test.CustomFilter2.doFilter(CustomFilter2.java:81)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
root cause
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.OutOfMemoryError: Java heap space
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:746)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:716)
org.apache.jsp.test2_jsp._jspService(test2_jsp.java:122)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
test.CustomLocaleRemapViewHandler.renderView(CustomLocaleRemapViewHandler.java:94)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
test.CustomFilter.doFilter(CustomFilter.java:46)
test.CustomFilter2.doFilter(CustomFilter2.java:81)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
root cause
javax.servlet.ServletException: java.lang.OutOfMemoryError: Java heap space
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
org.apache.jsp.test_jsp._jspService(test_jsp.java:745)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:746)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:716)
org.apache.jsp.test2_jsp._jspService(test2_jsp.java:122)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
test.CustomLocaleRemapViewHandler.renderView(CustomLocaleRemapViewHandler.java:94)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
test.CustomFilter.doFilter(CustomFilter.java:46)
test.CustomFilter2.doFilter(CustomFilter2.java:81)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
root cause
java.lang.OutOfMemoryError: Java heap space
java.util.Arrays.copyOf(Unknown Source)
java.io.ByteArrayOutputStream.grow(Unknown Source)
java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source)
java.io.ByteArrayOutputStream.write(Unknown Source)
sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
sun.nio.cs.StreamEncoder.implWrite(Unknown Source)
sun.nio.cs.StreamEncoder.write(Unknown Source)
java.io.OutputStreamWriter.write(Unknown Source)
java.io.PrintWriter.write(Unknown Source)
java.io.PrintWriter.write(Unknown Source)
test.CustomWrapper$CustomPrintWriter.write(CustomWrapper.java:82)
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:119)
org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:336)
java.io.Writer.write(Unknown Source)
com.sun.faces.renderkit.html_basic.HtmlResponseWriter.write(HtmlResponseWriter.java:519)
com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:196)
org.apache.jsp.test_jsp._jspService(test_jsp.java:725)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
ところで、BalusC、あなたがそこにいるなら助けてください。プレッシャーはありません、笑。JSF の質問の約半分に回答します。
グレー