I'm creating a webservice client to send huge files using MTOM. The server
side (CXF) is implemented correctly: MTOM is enabled and is using
DataHandler instead of byte[]. I tested the server side with not-that-big
files and is working as expected: the client is sending and XOP attachment
and the server side is getting a well formed DataHandler that allows read
the file and put it in th file system (or database) whiout loading all in
memory.
Everything seems to be working, but when I try to send huge files (23 GB) I
get a /java.lang.OutOfMemoryError/ in the client side (and no logs in the
server side). This is the client side implementation:
*
DataServiceService dataServiceService = new DataServiceService(new
URL(serviceURI + "?wsdl"), new QName(endpointNamespace, endpointName));
DataService dataService = dataServiceService.getPort(DataService.class);
BindingProvider bindingProvider = (BindingProvider) dataService;
Map<String, Object> requestContext = bindingProvider.getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY, user);
requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
((SOAPBinding) bindingProvider.getBinding()).setMTOMEnabled(true);
// Preparing the request
dataService.update(objects, true); // service call*
When the service is called, I got:
*Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)
at javax.activation.DataHandler.writeTo(DataHandler.java:294)
at
com.sun.xml.internal.ws.encoding.MtomCodec$ByteArrayBuffer.write(MtomCodec.java:189)
at com.sun.xml.internal.ws.encoding.MtomCodec.encode(MtomCodec.java:156)
at
com.sun.xml.internal.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:249)
at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:144)
at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
at
com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:105)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
at
com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy38.update(Unknown Source)*
This stack trace bugs me: We see that the client is using MTOM
/(MtomCodec.encode(MtomCodec.java:156)/ but this codec is using a
/ByteArrayOutputStream/ ???
Can some here help to understand this? and obviously ... if you know how to
solve this pleeeese let me know!
--
View this message in context:
http://cxf.547215.n5.nabble.com/java-lang-OutOfMemoryError-in-a-MTOM-client-tp5709736.html
Sent from the cxf-issues mailing list archive at Nabble.com.