You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Robert ." <ro...@gmail.com> on 2019/02/28 15:11:54 UTC
JMS+MTOM OutOfMemoryError
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
Re: JMS+MTOM OutOfMemoryError
Posted by Daniel Kulp <dk...@apache.org>.
> On Mar 1, 2019, at 4:12 AM, Robert . <ro...@gmail.com> wrote:
>
> Thanks for your reply Dan. It seems I have to add something like a ftp
> server into the mix.
>
> I have read ActiveMQ support blob messages using out-of-band transport. Do
> you perhaps know if I can register something with CXF so it supports
> activemq BlobMessage on the client and server side?
Not easily, no. And I don’t think it would be what you need either as with BlobMessage, the entire payload is in the blob that is stored on the file system/ftp/etc… so the soap message and attachments and everything would need to be stored into a file, stored someplace, then sent as the blob message, then deleted on ack…. Doable, but definitely more complex and you would need to definitely update the CXF JMS code to do it. A patch would be welcome, but probably not something any of us would spend a lot of time on consider that the blob message is an activemq proprietary extension.
Dan
>
> Robert
>
>
> On Thu, 28 Feb 2019 at 16:23, Daniel Kulp <dkulp@apache.org <ma...@apache.org>> wrote:
>
>>
>> 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 . <ro...@gmail.com>
>> 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
>> dkulp@apache.org <ma...@apache.org> <mailto:dkulp@apache.org <ma...@apache.org>> - http://dankulp.com/blog <http://dankulp.com/blog> <
>> http://dankulp.com/blog <http://dankulp.com/blog>>
>> Talend Community Coder - http://talend.com <http://talend.com/> <http://coders.talend.com/ <http://coders.talend.com/>>
--
Daniel Kulp
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://talend.com <http://coders.talend.com/>
Re: JMS+MTOM OutOfMemoryError
Posted by "Robert ." <ro...@gmail.com>.
Thanks for your reply Dan. It seems I have to add something like a ftp
server into the mix.
I have read ActiveMQ support blob messages using out-of-band transport. Do
you perhaps know if I can register something with CXF so it supports
activemq BlobMessage on the client and server side?
Robert
On Thu, 28 Feb 2019 at 16:23, Daniel Kulp <dk...@apache.org> wrote:
>
> 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 . <ro...@gmail.com>
> 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
> dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <
> http://dankulp.com/blog>
> Talend Community Coder - http://talend.com <http://coders.talend.com/>
>
Re: JMS+MTOM OutOfMemoryError
Posted by Daniel Kulp <dk...@apache.org>.
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 . <ro...@gmail.com> 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
dkulp@apache.org <ma...@apache.org> - http://dankulp.com/blog <http://dankulp.com/blog>
Talend Community Coder - http://talend.com <http://coders.talend.com/>