Apache Commons File Upload Problem

Discussion in 'Java' started by Chase Preuninger, Jun 14, 2008.

  1. 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)
     
    Chase Preuninger, Jun 14, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chase Preuninger

    Apache Commons File Upload

    Chase Preuninger, Jun 6, 2008, in forum: Java
    Replies:
    1
    Views:
    367
    Arne Vajhøj
    Jun 7, 2008
  2. Replies:
    0
    Views:
    324
  3. Replies:
    1
    Views:
    2,462
  4. Replies:
    0
    Views:
    318
  5. pinik
    Replies:
    0
    Views:
    298
    pinik
    Oct 28, 2008
Loading...

Share This Page