I have a web application sitting there which is a repository for files. This web application provides web services that allow clients to search the repository and download any attachments through SOAP.
Currently, I have tried using Spring -WS 1.5.8 with MTOM to send attachments to the client, but I am losing memory all the time. I do not believe that these errors are related to my Tomcat 6 instance, because my server has 8 GB of memory, and I configured Tomcat to use 4 GB. I get these errors in files up to 200 MB in size.
I need to use SOAP, although this is probably not the best approach. I would prefer a solution in Spring, but if that is not possible then I am open to other ideas. I read that AxiomSoapMessageFactory can be used to stream files to the server for upload, but not vice versa. It's true? I am using Java 6.
Here is the error that I keep getting as part of the Spring WS Framework:
java.lang.OutOfMemoryError: Java heap space
com.sun.xml.internal.messaging.saaj.util.ByteOutputStream.ensureCapacity(Unknown Source)
com.sun.xml.internal.messaging.saaj.util.ByteOutputStream.write(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.BMMimeMultipart.find(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.BMMimeMultipart.readBody(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.BMMimeMultipart.getNextPart(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.BMMimeMultipart.parse(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.BMMimeMultipart.parse(Unknown Source)
com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeMultipart.getCount(Unknown Source)
com.sun.xml.internal.messaging.saaj.soap.MessageImpl.initializeAllAttachments(Unknown Source)
com.sun.xml.internal.messaging.saaj.soap.MessageImpl.getAttachments(Unknown Source)
org.springframework.ws.soap.saaj.Saaj13Implementation.getAttachment(Saaj13Implementation.java:305)
org.springframework.ws.soap.saaj.SaajSoapMessage.getAttachment(SaajSoapMessage.java:226)
org.springframework.ws.support.MarshallingUtils$MimeMessageContainer.getAttachment(MarshallingUtils.java:109)
org.springframework.oxm.jaxb.Jaxb2Marshaller$Jaxb2AttachmentUnmarshaller.getAttachmentAsDataHandler(Jaxb2Marshaller.java:532)
com.sun.xml.internal.bind.v2.runtime.unmarshaller.MTOMDecorator.startElement(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(Unknown Source)
com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:421)
org.springframework.ws.support.MarshallingUtils.unmarshal(MarshallingUtils.java:62)
org.springframework.ws.client.core.WebServiceTemplate$3.extractData(WebServiceTemplate.java:374)
org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:560)
source
share