MTOM - OutOfMemoryError with large files · Issue #29 · javaee/metro-jax-ws (original) (raw)

Hello,

I am trying to upload large files with MTOM. I have played around with -Xms and
-Xmx options but this didn't solve the problem. The test file I try to transfer
is around 690MB.

I am working on a centrino duo with 2GB ram, so hardware shouldn't be a problem.

First I tried without settings a higher Xms and Xmx (using default) and I got

the following:

com.sun.xml.messaging.saaj.soap.MessageImpl saveChanges

SEVERE: SAAJ0540: Error during saving a multipart message
Exception in thread "main" javax.xml.ws.WebServiceException:
com.sun.xml.messaging.saaj.SOAPExceptionImpl: Error during saving a multipart
message
...
Caused by: java.lang.OutOfMemoryError: Java heap space

after tried with -Xms 512m -Xmx1024m

Exception in thread "main" java.lang.OutOfMemoryError

at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:194)
at
com.sun.xml.bind.v2.util.ByteArrayOutputStreamEx.readFrom(ByteArrayOutputStreamEx.java:40)
at
com.sun.xml.bind.v2.runtime.unmarshaller.Base64Data.get(Base64Data.java:153)
at
com.sun.xml.bind.v2.runtime.output.StAXExStreamWriterOutput.text(StAXExStreamWriterOutput.java:31)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:312)
at
com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$PcdataImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:140)
at
com.sun.xml.bind.v2.runtime.MimeTypedTransducer.writeLeafElement(MimeTypedTransducer.java:56)
at
com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:206)
at
com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:62)
at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:241)
at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:54)
at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:60)
at
com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:244)
at
com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:117)
at com.sun.xml.ws.encoding.MtomCodec.encode(MtomCodec.java:135)
at com.sun.xml.ws.encoding.CodecFacade.encode(CodecFacade.java:170)
at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:110)
at com.sun.xml.ws.protocol.soap.ClientMUPipe.process(ClientMUPipe.java:58)
at com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
at com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
at com.sun.xml.ws.client.Stub.process(Stub.java:121)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:122)
at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:238)
at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:212)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:105)
at $Proxy19.uploadFile(Unknown Source)
at be.kzen.mtomclient.Client.run(Client.java:34)
at be.kzen.mtomclient.Client.main(Client.java:19)

Even if I would set a higher Xms which can handle the one large file, that would
still not be the solution for the real world with multiple downloads/uploads.

Thanks

Environment

Operating System: Windows XP
Platform: All

Affected Versions

[current]