This is almost certainly not going to work.   The JMS spec doesn’t really have 
a way to stream things, so it always holds the entire message in memory.  
(StreamMessage doesn’t actually stream)


Dan



> On Feb 28, 2019, at 10:11 AM, Robert . <[email protected]> wrote:
> 
> Hi cxf users and developers,
> 
> I'm using MTOM to send large files. This works great for SOAP HTTP
> requests. Both the client and server can send the messages with low memory
> consumption.
> Unfortunately when I use SOAP JMS I get a heap space OutOfMemoryError.
> I tried using CXF 3.2.7 and 3.3.0.
> Any help is very much appreciated.
> 
> This is the stack trace:
> 
> Caused by: java.lang.OutOfMemoryError: Java heap space
>    at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:77)
>    at org.apache.cxf.helpers.IOUtils.readBytesFromStream(IOUtils.java:401)
>    at
> org.apache.cxf.io.CachedOutputStream.getBytes(CachedOutputStream.java:306)
>    at
> org.apache.cxf.transport.jms.MessageStreamUtil$SendingOutputStream.doClose(MessageStreamUtil.java:81)
>    at
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:222)
>    at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
>    at org.apache.cxf.transport.jms.JMSConduit.close(JMSConduit.java:104)
>    at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
>    at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
>    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440)
>    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)
>    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
>    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>    at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140)
>    at com.sun.proxy.$Proxy76.addDocumentMtom(Unknown Source)
> 
> 
> I have configure my JaxWsProxyFactoryBean like this:
> 
>   JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>    Map<String, Object> props = new HashMap<>();
>    props.put("mtom-enabled", Boolean.TRUE);
>    factory.setProperties(props);
>    factory.setFeatures(Collections.singletonList(new
> ConnectionFactoryFeature(connectionFactory)));
> 
> factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
>    factory.setServiceClass(DocumentServiceOneWay.class);
> 
> factory.setAddress("jms:queue:DocumentServiceQueue?sessionTransacted=true");
> 
> Kind regards,
> Robert

-- 
Daniel Kulp
[email protected] <mailto:[email protected]> - http://dankulp.com/blog 
<http://dankulp.com/blog>
Talend Community Coder - http://talend.com <http://coders.talend.com/>

Reply via email to