我有一个Web应用程序,那里是文件存储库.该Web应用程序提供Web服务,这些服务允许客户端搜索存储库并通过SOAP下载任何附件.
目前,我已经尝试将Spring-WS 1.5.8与MTOM一起使用,以将附件发送给客户端,但是我总是遇到内存不足的错误.我不认为这些错误与我的Tomcat 6实例有关,因为我的服务器具有8GB的内存,而我将Tomcat配置为使用4GB的内存.我在最小200MB的文件上遇到这些错误.
我需要使用SOAP,尽管它可能根本不是最好的方法.我希望在Spring中找到解决方案,但是如果不可能,那么我可以接受其他想法.我读到可以使用AxiomSoapMessageFactory将文件流式传输到服务器以进行上传,但不能相反.这是真的?我正在使用Java 6.
这是我一直在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)