Apache Commons File Upload Problem

C

Chase Preuninger

Why do I get this error when I upload a really big file.

ServletFileUpload upload = new ServletFileUpload(new
DiskFileItemFactory(512, new Fil(Constants.FILES_BUFFER_DIRECTORY)));

....

File uploadedFile = new File(file.getName());
File to = new File(Constants.NOTES_DIRECTORY, id +
uploadedFile.getName());
to.createNewFile();
ReadableByteChannel in = null;
FileChannel out = null;
try
{
out = new FileOutputStream(to).getChannel();
in = Channels.newChannel(file.getInputStream());
out.transferFrom(in, 0, file.getSize());
NotesManager.setNoteReady(id, to.getName(), conn);
}

....


Jun 13, 2008 9:05:06 PM org.apache.catalina.connector.CoyoteAdapter
service
SEVERE: An exception or error occurred in the container during the
request processing
java.lang.ArrayIndexOutOfBoundsException: 8192
at
org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:
711)
at
org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:
618)
at
org.apache.coyote.http11.InternalOutputBuffer.sendHeader(InternalOutputBuffer.java:
491)
at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:
1599)
at
org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:
934)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.coyote.Response.sendHeaders(Response.java:379)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:
305)
at
org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:
273)
at
org.apache.catalina.connector.Response.finishResponse(Response.java:
492)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
310)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
844)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint
$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jun 13, 2008 9:05:06 PM org.apache.coyote.http11.Http11Processor
process
SEVERE: Error finishing response
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:
680)
at
org.apache.coyote.http11.InternalOutputBuffer.sendStatus(InternalOutputBuffer.java:
419)
at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:
1588)
at
org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:
934)
at org.apache.coyote.Response.action(Response.java:181)
at
org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:
379)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
879)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint
$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top