I'm using spring ws on the server side with a AxiomSoapmessageFactory:
This works fine when the services are ingesting a message. However, when the services attempt to serve up a large message I get Java out of memory exception. Here is the stack trace:Code:<bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"> <property name="payloadCaching" value="true"/> <!-- Need to figure out the appropriate directory --> <property name="attachmentCacheDir" value="..."/> </bean>
The problem seems to be that the services are attempting to read the whole attachment into memory prior to writing it out. Is there a way to stream the attachment?
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutpu tStream.java:94)
at org.apache.axiom.mime.impl.axiom.MultipartWriterIm pl$PartOutputStream.write(MultipartWriterImpl.java :42)
at javax.activation.DataHandler.writeTo(DataHandler.j ava:294)
at org.apache.axiom.mime.impl.axiom.MultipartWriterIm pl.writePart(MultipartWriterImpl.java:116)
at org.apache.axiom.om.impl.OMMultipartWriter.writePa rt(OMMultipartWriter.java:136)
at org.apache.axiom.om.impl.MIMEOutputUtils.writeSOAP WithAttachmentsMessage(MIMEOutputUtils.java:269)
at org.springframework.ws.soap.axiom.AxiomSoapMessage .writeSwAMessage(AxiomSoapMessage.java:298)
at org.springframework.ws.soap.axiom.AxiomSoapMessage .writeTo(AxiomSoapMessage.java:248)
at org.springframework.ws.server.MessageDispatcher.ge tMessageContent(MessageDispatcher.java:192)
at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:174)
at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handleConnection(Web ServiceMessageReceiverObjectSupport.java:88)
at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.ErrorAwareWe bServiceMessageReceiverHandlerAdapter.handle(Error AwareWebServiceMessageReceiverHandlerAdapter.java: 42)
at org.springframework.ws.transport.http.MessageDispa tcherServlet2.doService(MessageDispatcherServlet2. java:148)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:680)
I'm running this in a Tomcat instance on OSX 10.6.7 java --version =
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)


Reply With Quote