Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-16282

Red Hat Fuse 7.8 on Karaf : camel-activemq consumer throw javax.jms.MessageNotWriteableException with AMQ7

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.9-GA
    • fuse-7.8-GA
    • ActiveMQ, Karaf
    • None
    • False
    • False
    • % %
    • +
    • Undefined
    • Hide
      • This error occurs when producer client is sending a large message with _AMQ_LARGE_SIZE as message property.
      msg.setLongProperty("_AMQ_LARGE_SIZE", 1050000L); 
      • Attached is the producer client ActiveMQ_Sender_Receiver.zip sending message. I used eclipse IDE to run QueueSend.java in the project with broker url as argument.
      • We will need AMQ 7.8 standalone instance too.
      • Attached is the camel consumer code. It can be deployed in Red Hat Fuse 7.8 with commands. In blueprint.xml of this project there may be a need to change broker url.
         feature:install camel-activemq
         bundle:install -s mvn:com.mycompany/activemq-example/1.0 
      • Start sending message, we should observe error as in description section immediately in Red Hat Fuse logs.
      • This issue doesn't happen with camel-jms quickstart example in Red Hat Fuse 7.8 which use artemis client.
      • Also in latest camel code there seems to be support for streaming for artemis, not sure if it is helpful. It is not available with Red Hat Fuse 7.8.
      Show
      This error occurs when producer client is sending a large message with  _AMQ_LARGE_SIZE  as message property. msg.setLongProperty( "_AMQ_LARGE_SIZE" , 1050000L); Attached is the producer client ActiveMQ_Sender_Receiver.zip sending message. I used eclipse IDE to run QueueSend.java in the project with broker url as argument. We will need AMQ 7.8 standalone instance too. Attached is the camel consumer code. It can be deployed in Red Hat Fuse 7.8 with commands. In blueprint.xml of this project there may be a need to change broker url. feature:install camel-activemq  bundle:install -s mvn:com.mycompany/activemq-example/1.0 Start sending message, we should observe error as in description section immediately in Red Hat Fuse logs. This issue doesn't happen with camel-jms quickstart example in Red Hat Fuse 7.8 which use artemis client. Also in latest camel code there seems to be support for streaming for artemis, not sure if it is helpful. It is not available with Red Hat Fuse 7.8.

      Error observed 

      2021-04-21 15:26:35,032 | WARN  | sConsumer[someQueue] | .a.c.c.j.EndpointMessageListener | 64 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract body due to: javax.jms.MessageNotWriteableException: Message properties are read-only. Message: ActiveMQBytesMessage {commandId = 5, responseRequired = false, messageId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1, destination = queue://someQueue, transactionId = null, expiration = 0, timestamp = 1618493375280, arrival = 0, brokerInTime = 1618493377592, brokerOutTime = 1618998994984, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@7b4ac272, marshalledProperties = org.apache.activemq.util.ByteSequence@3c2f482, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {__AMQ_CID=ID:cpandey.pnq.csb-34221-1618493365503-0:1, _AMQ_LARGE_SIZE=1050000}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }]2021-04-21 15:26:35,032 | WARN  | sConsumer[someQueue] | .a.c.c.j.EndpointMessageListener | 64 - org.apache.camel.camel-core - 2.23.2.fuse-780036-redhat-00001 | Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - Failed to extract body due to: javax.jms.MessageNotWriteableException: Message properties are read-only. Message: ActiveMQBytesMessage {commandId = 5, responseRequired = false, messageId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1, destination = queue://someQueue, transactionId = null, expiration = 0, timestamp = 1618493375280, arrival = 0, brokerInTime = 1618493377592, brokerOutTime = 1618998994984, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@7b4ac272, marshalledProperties = org.apache.activemq.util.ByteSequence@3c2f482, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {__AMQ_CID=ID:cpandey.pnq.csb-34221-1618493365503-0:1, _AMQ_LARGE_SIZE=1050000}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null }]org.apache.camel.RuntimeCamelException: Failed to extract body due to: javax.jms.MessageNotWriteableException: Message properties are read-only. Message: ActiveMQBytesMessage {commandId = 5, responseRequired = false, messageId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:cpandey.pnq.csb-34221-1618493365503-1:1:1:1, destination = queue://someQueue, transactionId = null, expiration = 0, timestamp = 1618493375280, arrival = 0, brokerInTime = 1618493377592, brokerOutTime = 1618998994984, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@7b4ac272, marshalledProperties = org.apache.activemq.util.ByteSequence@3c2f482, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {__AMQ_CID=ID:cpandey.pnq.csb-34221-1618493365503-0:1, _AMQ_LARGE_SIZE=1050000}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = null } at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:176) ~[?:?] at org.apache.camel.component.jms.JmsMessage.createBody(JmsMessage.java:227) ~[?:?] at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:54) ~[?:?] at org.apache.camel.util.MessageHelper.getBodyTypeName(MessageHelper.java:110) ~[?:?] at org.apache.camel.processor.interceptor.DefaultTraceFormatter.format(DefaultTraceFormatter.java:94) ~[?:?] at org.apache.camel.processor.interceptor.TraceInterceptor.format(TraceInterceptor.java:276) ~[?:?] at org.apache.camel.processor.CamelLogProcessor.process(CamelLogProcessor.java:112) ~[?:?] at org.apache.camel.processor.interceptor.TraceInterceptor.logException(TraceInterceptor.java:335) ~[?:?] at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:206) ~[?:?] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) ~[?:?] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) ~[?:?] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) ~[?:?] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) ~[?:?] at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:113) ~[?:?] at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) ~[!/:?] at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) [!/:?] at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) [!/:?] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) [!/:?] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) [!/:?] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189) [!/:?] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179) [!/:?] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076) [!/:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_272] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_272] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_272]
      
      Caused by: javax.jms.MessageNotWriteableException: Message properties are read-only at 
      
      org.apache.activemq.command.ActiveMQMessage.checkReadOnlyProperties(ActiveMQMessage.java:740) ~[?:?] at org.apache.activemq.command.ActiveMQBytesMessage.setObjectProperty(ActiveMQBytesMessage.java:915) ~[?:?] at org.apache.camel.component.jms.JmsBinding.createByteArrayFromBytesMessage(JmsBinding.java:255) ~[?:?] at org.apache.camel.component.jms.JmsBinding.extractBodyFromJms(JmsBinding.java:167) ~[?:?] ... 24 more
       

        1. activemq-example.tar
          76 kB
          Freeman(Yue) Fang

              yfang@redhat.com Freeman(Yue) Fang
              rhn-support-cpandey Chandra Shekhar Pandey (Inactive)
              Federico Mariani Federico Mariani
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: