madhairsilence
madhairsilence

Reputation: 3880

javax.jms.MessageNotReadableException: Message body is write-only

Am having a weird problem

ActiveMQ is the messaging server and am using AMQP for sending messages

When I have both the publisher and subscriber in the same eclipse project. I can send send ObjectMessage and receive without any problem

But , when I split the subscriber and publisher to two different eclipse project, am getting

javax.jms.MessageNotReadableException: Message body is write-only

This is my Class of the object am sending

public class Test1 implements Serializable{

    private String x;

    public Test1( String x){
        this.x = x;
    }
}

And this is the exception

javax.jms.MessageNotReadableException: Message body is write-only
        at org.apache.activemq.command.ActiveMQBytesMessage.checkWriteOnlyBody(ActiveMQBytesMessage.java:863)
        at org.apache.activemq.command.ActiveMQBytesMessage.initializeReading(ActiveMQBytesMessage.java:868)
        at org.apache.activemq.command.ActiveMQBytesMessage.getBodyLength(ActiveMQBytesMessage.java:190)
        at org.apache.qpid.proton.jms.AMQPNativeOutboundTransformer.transform(AMQPNativeOutboundTransformer.java:63)
        at org.apache.qpid.proton.jms.AutoOutboundTransformer.transform(AutoOutboundTransformer.java:37)
        at org.apache.activemq.transport.amqp.AmqpProtocolConverter$ConsumerContext.pumpOutbound(AmqpProtocolConverter.java:751)
        at org.apache.activemq.transport.amqp.AmqpProtocolConverter$ConsumerContext.onMessageDispatch(AmqpProtocolConverter.java:710)
        at org.apache.activemq.transport.amqp.AmqpProtocolConverter.onActiveMQCommand(AmqpProtocolConverter.java:300)
        at org.apache.activemq.transport.amqp.AmqpTransportFilter.oneway(AmqpTransportFilter.java:64)
        at org.apache.activemq.broker.TransportConnection.dispatch(TransportConnection.java:1378)
        at org.apache.activemq.broker.TransportConnection.processDispatch(TransportConnection.java:897)
        at org.apache.activemq.broker.TransportConnection.iterate(TransportConnection.java:943)
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:129)
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:47)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:679)

This is the Code am following

https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java?r=1406466&r=1414990

Upvotes: 0

Views: 2627

Answers (2)

madhairsilence
madhairsilence

Reputation: 3880

This is supposed to be a bug in ActiveMQ with AMQ

This error happens under two reproducible conditions

  1. Sending object as message (Currently cannot send Object)
  2. When the consumer encounters some exceptions

The notable thing here is

This is in no way affects the message being transmitted. You will just see the exception but the data transport will work fine!!!

Upvotes: 2

Tim Bish
Tim Bish

Reputation: 18376

This sounds like a bug, open a Jira issue on the ActiveMQ site and post a test case, I don't think there's any magic switch here to fix the exception. Without posting your code that's all we can say.

Upvotes: 0

Related Questions