users@jersey.java.net

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

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 09 Mar 2009 09:26:38 -0400

Sounds like you are running into an issue where the input is being
buffered before the method is dispatched. What is the Java type of the
argument that represents the entity in your method, have you tried
using java.io.File instead ?

Marc.

On Mar 8, 2009, at 6:04 PM, jmiller wrote:

>
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>