httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dattaprasad Kamat <>
Subject [users@httpd] "java.lang.OutOfMemoryException : Java heap space" for download due to ExtensionsFilter
Date Wed, 15 Feb 2006 13:33:00 GMT
Hi All,

 I need help ...

 I'm using the Tomahawk library in our project. In web.xml I have an entry
as follows ...,

          <!-- servlet-name must match the name of your
javax.faces.webapp.FacesServlet entry -->
          <servlet-name>Faces Servlet</servlet-name>

      <!-- extension mapping for serving page-independent resources
(javascript, stylesheets, images, etc.)  -->

In the project I have download code as follows :

 private void copyFileToResponse(HttpServletResponse response,
FileInputStream fileIn) throws IOException {
         int BUFF_SIZE=4096;
   byte[] buffer = new byte[BUFF_SIZE];
   ServletOutputStream responseOutStream = response.getOutputStream();
         BufferedInputStream buf = new BufferedInputStream(fileIn);
         int n = 0;
         int count = 0;

  while((n = != -1) {

 //            responseOutStream.write(buffer);
   "while loop : before write to Buffer and count => "
+ count);
             count += n;

   "while loop : copyFileToResponse flush");
   "while loop : copyFileToResponse flushBuffer");
   "while loop : after buffer read");
         }"after while loop : before flushbuffer");
         buf.close();"after while loop : before flushbuffer");
         responseOutStream.close();"after while loop : after flushbuffer");

 My problem is as follows,

 If I have the mentioned entries in the web xml and I'm trying to downlaod >
100 MB file,

 the above code, throws

 "java.lang.OutOfMemoryException : Java heap space"


 But it works fine if I remove the entries from the web.xml file.

 I have debuuged and found that if I keep above "MyFacesExtensionsFilter"
related entries in web.xml, the response is instantiated from
org.apache.myfaces.component.html.util.ExtensionsResponseWrapper, in which
case flush() doesn't work and causes the "java.lang.OutOfMemoryException :
Java heap space" error.

 If I remove the MyFacesExtensionsFilter related entries, the response gets
instantiated by
 "org.apache.catalina.connector.CoyoteOutputStream", in which case flush
works fine.

 Can anyone tell me how to avoid this situation by still maintaing the
"MyFacesExtensionsFilter" related entries in the web.xml.


View raw message