AMQP producer based persistant messages are not being dequeued by a consumer

Solution Unverified - Updated -


  • I ran a simple test with an AMQP based message producer sending JMS TextMessages to a persistent queue. It looks like internally the messages are persisted as ByteMessages.

Without the broker being restarted, a consumer is able to pull the messages as TextMessages.

However, when the broker is restarted with pending messages in the queue, subsequent attempts by a consumer to read the messages off the queue fail with the below exception on the server side.

javax.jms.MessageNotReadableException: Message body is write-only
        at org.apache.activemq.command.ActiveMQBytesMessage.checkWriteOnlyBody(
        at org.apache.activemq.command.ActiveMQBytesMessage.initializeReading(
        at org.apache.activemq.command.ActiveMQBytesMessage.getBodyLength(
        at org.apache.qpid.proton.jms.AMQPNativeOutboundTransformer.transform(
        at org.apache.qpid.proton.jms.AutoOutboundTransformer.transform(
        at org.apache.activemq.transport.amqp.AmqpProtocolConverter$ConsumerContext.pumpOutbound(AmqpProtocolConverter.j

On the client side, the below exception is seen.

java.lang.ClassCastException: org.apache.activemq.command.ActiveMQBytesMessage cannot be cast to javax.jms.TextMessage
        at org.apache.activemq.ActiveMQMessageConsumer.dispatch(


  • JBoss A-MQ
    • 6.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content