java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I send a message using RabbitMQ Java client - com.rabbitmq.client.Channel#basicPublish(String, String, BasicProperties, byte[]) - with null BasicProperties, which seems to be a valid case. I get NPE when I try to print the message within the MessageListener implementation: {code} java.lang.NullPointerException at org.springframework.amqp.core.Message.getBodyContentAsString(Message.java:70) at org.springframework.amqp.core.Message.toString(Message.java:56) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at com.ndpar.spring.rabbitmq.MessageHandler.onMessage(MessageHandler.java:14) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:316) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:254) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:230) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:199) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.processMessage(SimpleMessageListenerContainer.java:229) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:288) at java.lang.Thread.run(Thread.java:637) {code}
    via by Andrey Paramonov,
    • java.lang.NullPointerException at org.springframework.amqp.core.Message.getBodyContentAsString(Message.java:70) at org.springframework.amqp.core.Message.toString(Message.java:56) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at com.ndpar.spring.rabbitmq.MessageHandler.onMessage(MessageHandler.java:14) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:316) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:254) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:230) at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:199) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.processMessage(SimpleMessageListenerContainer.java:229) at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:288) at java.lang.Thread.run(Thread.java:637)
    No Bugmate found.