Results 1 to 3 of 3

Thread: Spring WS MTOM OutOfMemoryError

  1. #1
    Join Date
    Feb 2011
    Location
    Surrey, UK
    Posts
    2

    Default Spring WS MTOM OutOfMemoryError

    Hello,

    I'm having problems uploading large attachments using Spring WS 2, Axiom and MTOM.

    It appears that when unmarshalling the request the StaxStreamConnector is ignoring the fact that it's an MTOM attachment and still trying to buffer the attatchment as Characters.

    The Stack Trace I get when performing the upload is:
    Code:
    java.lang.OutOfMemoryError: Requested array size exceeds VM limit
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:44)
    at java.lang.StringBuffer.<init>(StringBuffer.java:92)
    at org.apache.axiom.util.base64.Base64Utils.encode(Base64Utils.java:74)
    at org.apache.axiom.om.impl.llom.OMTextImpl.getText(OMTextImpl.java:264)
    at org.apache.axiom.om.impl.SwitchingWrapper.getTextFromNode(SwitchingWrapper.java:430)
    at org.apache.axiom.om.impl.SwitchingWrapper.getTextCharacters(SwitchingWrapper.java:409)
    at javax.xml.stream.util.StreamReaderDelegate.getTextCharacters(StreamReaderDelegate.java:188)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleCharacters(StAXStreamConnector.java:328)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:192)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:366)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:338)
    at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshalStaxSource(Jaxb2Marshaller.java:592)
    at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:578)
    at org.springframework.ws.support.MarshallingUtils.unmarshal(MarshallingUtils.java:62)
    at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.unmarshalRequest(AbstractMarshallingPayloadEndpoint.java:145)
    at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
    at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
    at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:230)
    at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:172)
    at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
    at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
    at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:222)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
    I did notice that Axiom's OMXMLStreamReader has a flag isInlineMTOM which decides whether the attachment is inlined as Text, or passed back as an XOP_INCLUDE (this flag is actually deprecated, in favour of using an XOPEncodingStreamReader) should there be a way to specify the use of this type of reader within Spring, or am I missing something?!

    Thanks in advance for any pointers you can provide,

    Chris

  2. #2
    Join Date
    Feb 2011
    Location
    Surrey, UK
    Posts
    2

    Default

    Does anyone have any views on this yet?

    Thanks,

    Chris

  3. #3

    Default

    Spring WS & streaming attachment doesnt work.If im wrong im still waiting for a proof of concept with a file of 100mo without outOfMemory, not in request ANd response.
    IN request i can dot it.
    I have try everything : Axiom, Saaj, axiom compatible Saaj. Axiom doesnt supports Mtom correctly & my last try the most concluant is to use the last saaj api not of the jdk. It streams nicely because it is saved on file but you have to clean the temp directory from times to time.
    Need help on Spring WS ? Do you want to shift gears and build the architecture of your spring ws with half of the price that will be for your company ? I have worked on Spring Ws 1,5 year at full time and build around80 WS with full dao testing and integration tests with Soapui with Maven 2 on hudson

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •