The files are up to 30GB so it is not a solution. When I try without the buffer it doesn't seem to work at all. What I mean is that the servlet sends some data before the error occurs when sending with the buffer but I get 0KB without.
Best Regards Geoffrey Phone Norway: +47 45 86 53 83 Fileflow Technologies AS Ole Deviks vei 35, 0668 Oslo, Norway ------------------------------------- On 24 Nov 2009, at 18:22, Pid wrote: > On 24/11/2009 17:17, geoff...@fileflow.com wrote: >> The bytesRead returns the size of the buffer (8KB) every time. I also debug >> and I can't find anything wrong. Input and OutputStream are not null, >> bytesRead is the correct size and the buffer is also filled. >> >> Any other ideas? > > How big is the file you're sending? > Is there any particular reason to use a buffer? > What happens if you try without it? > > > p > > >> On 24 Nov 2009, at 18:13, Ronald Klop wrote: >> >>> Try insert some debug statements just before the out.write. >>> System.out.println("bytesRead: " + bytesRead) would be interesting. >>> >>> In fact this is kind of my-first-debugging and you don't even mention you >>> did try it. >>> >>> Ronald. >>> >>> >>> Op dinsdag, 24 november 2009 17:57 schreef geoff...@fileflow.com: >>>> Hi everyone. >>>> I'm stuck with a problem I don't understand. We have a tomcat server and >>>> after redeploying our war file, we get this error: >>>> java.lang.ArrayIndexOutOfBoundsException >>>> at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:346) >>>> at >>>> org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:764) >>>> at >>>> org.apache.coyote.http11.filters.IdentityOutputFilter.doWrite(IdentityOutputFilter.java:118) >>>> at >>>> org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:573) >>>> at org.apache.coyote.Response.doWrite(Response.java:560) >>>> at >>>> org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353) >>>> at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:325) >>>> at >>>> org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381) >>>> at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370) >>>> at >>>> org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89) >>>> at com.fileflow.downloader.Downloader.doGet(Downloader.java:123) >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) >>>> 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 >>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) >>>> at >>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) >>>> at >>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) >>>> at >>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) >>>> at >>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) >>>> at >>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) >>>> at >>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) >>>> at >>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) >>>> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) >>>> at java.lang.Thread.run(Thread.java:619) >>>> Notice that there are no number on the first line and it is usually the >>>> case. >>>> The code that is "responsible is: >>>> private ServletOutputStream out; >>>> private InputStream in; >>>> ... >>>> in = new FileInputStream(tmp); >>>> ... >>>> out = response.getOutputStream(); >>>> byte[] buf = new byte[8 * 1024]; // 8K buffer >>>> int bytesRead; >>>> while((bytesRead = in.read(buf))> 0) { >>>> out.write(buf, 0, bytesRead); >>>> } >>>> The updated code didn't change anything in that Servlet so I really have >>>> no clue what happened. It happens on tomcat 6.0.18 and 6.0.20. Java is >>>> 1.6.0_11. >>>> Thanks for any help. >>>> Best Regards >>>> Geoffrey >>> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
smime.p7s
Description: S/MIME cryptographic signature