我的问题类似于: 带有大消息的 JAX-WS SoapHandler:OutOfMemoryError和JAXWS Soap Handler Large MTOM Attachments
我正在使用 tomcat,即 Metro-Runtime-Configuration,当我想在其中添加标头时,HandlerChain
它给了我一个OutOfMemory
例外。
public boolean handleMessage(SOAPMessageContext smc) {
if (Boolean.TRUE.equals(smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY))) {
SOAPMessage sm = smc.getMessage(); // <- OutOfMemory
...
在第一个链接中,艾哈迈德写道,I was able to write code that handles the raw data stream in 3 out of the 4 cases. Fortunately the three cases included the two we were mostly interested in: to/from the server.
但他没有为此提供代码片段。
我尝试过的事情:
OutOfMemory
发生在AbstractMessageImpl#readAsSOAPMessage
我无法覆盖的JDK7中。是否可以使用自定义引导程序覆盖该类?以及如何做到这一点?我能够“覆盖” Integer
-class,但AbstractMessageImpl
没有被采纳。
将运行时更改为 Apache CXF 不适用于我生成的 JAX-WS RI 客户端 ( Cannot create a secure XMLInputFactory
)
是否有另一种使用另一个提供程序/运行时的可能性?如果没有,我怎样才能覆盖 JDK7 的AbstractMessageImpl#readAsSOAPMessage
?
或者:是否可以配置 MTOM 和处理程序链的顺序?MTOM 的消息不应该引发 OutOfMemory,对吗?
在此先感谢克拉皮