users@jersey.java.net

[Jersey] Very Large files causing java Out of Memory error

From: jmiller <jmiller_at_mokafive.com>
Date: Sun, 8 Mar 2009 15:04:59 -0700 (PDT)

I have written a REST service which is meant to handle files that are posted
to it. Smaller files work but larger files (50 meg Zip file) cause the
following thing:

java.lang.OutOfMemoryError: Java heap space
        java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:95)
        javax.mail.util.ByteArrayDataSource.<init>(ByteArrayDataSource.java:64)


I am using this set of annotations:

@POST
@Path("postbigfile")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces("text/plain")

I have tried MediaType.APPLICATION_OCTET_STREAM without success -- "The
server refused this request because the request entity is in a format not
supported by the requested resource for the requested method ()." is the
returned message in that case whether the file is big or small.

I note too that apparently the annotated method is not even entered; that
is, the OutOfMemory error occurs before the method is invoked and in fact it
is never invoked.
-- 
View this message in context: http://n2.nabble.com/Very-Large-files-causing-java-Out-of-Memory-error-tp2446303p2446303.html
Sent from the Jersey mailing list archive at Nabble.com.