title: Unable to read object content Spring Boot activemq
body: <p>I am trying to consume a POJO in the consumer side using Spring Boot and Active MQ. Message is received but not able to convert to actual type of the object with the below exception:</p>
  
  <p><strong>Exception:</strong></p>
  
  <pre><code>2018-08-01 10:51:35.542  INFO 9280 --- [enerContainer-1] com.example.JmsConsumer                  : Message reached in consumer side...
  2018-08-01 10:51:35.542  INFO 9280 --- [enerContainer-1] com.example.JmsConsumer                  : +++++++++++++++++++++++++++++++++++++++++++++++++++++
  2018-08-01 10:51:35.547  WARN 9280 --- [enerContainer-1] o.s.j.l.DefaultMessageListenerContainer  : Execution of JMS message listener failed, and no ErrorHandler has been set.
  
  java.lang.AbstractMethodError: org.apache.activemq.command.ActiveMQObjectMessage.getBody(Ljava/lang/Class;)Ljava/lang/Object;
      at com.example.JmsConsumer.receive(JmsConsumer.java:49) ~[classes/:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
  </code></pre>
  
  <p><strong>POJO:</strong></p>
  
  <pre><code>public class OrderDetails implements Serializable{
      private Long id;
      private String name;
      private double itemPrice;
      private double totalPrice;
      private String orderStatus;
  
  }
  </code></pre>
  
  <p><strong>Publisher side:</strong></p>
  
  <pre><code>import javax.jms.JMSException;
  import javax.jms.ObjectMessage;
  import javax.jms.Session;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.jms.core.JmsTemplate;
  import org.springframework.jms.core.MessageCreator;
  import org.springframework.stereotype.Component;
  
  import com.example.model.OrderDetails;
      @Component
      public class JmsProducer  {
  
          @Autowired
          JmsTemplate jmsTemplate;
  
          @Value("${jsa.activemq.queue}")
          String queueName;
  
          public void send(OrderDetails msg) {
              this.jmsTemplate.convertAndSend(queueName, msg);
      }
  </code></pre>
  
  <p><strong>Consumer side:</strong></p>
  
  <pre><code>import javax.jms.JMSException;
  import javax.jms.Message;
  import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.jms.annotation.JmsListener;
      import org.springframework.stereotype.Component;
      import org.springframework.web.client.RestTemplate;
  
      import com.example.model.OrderDetails;
      import com.fasterxml.jackson.databind.ObjectMapper;
  
      import lombok.extern.slf4j.Slf4j;
  
          @Component
          @Slf4j
          public class JmsConsumer {
  
    @JmsListener(destination = "${jsa.activemq.queue}", containerFactory="jsaFactory")
         public void receive(Message message) throws JMSException{
                  log.info("Message reached in consumer side...");
                      log.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++");
            OrderDetails response = Message.getBody(OrderDetails.class);
         log.info("Application : object received : {}",response);
              }
        }
  </code></pre>
  
  <p><strong>Active MQ Config:</strong></p>
  
  <pre><code>import javax.jms.ConnectionFactory;
  
  import org.apache.activemq.ActiveMQConnectionFactory;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
  import org.springframework.jms.config.JmsListenerContainerFactory;
  import org.springframework.jms.core.JmsTemplate;
  import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
  import org.springframework.jms.support.converter.MessageConverter;
  import org.springframework.jms.support.converter.MessageType;
  
  @Value("${jsa.activemq.broker.url}")
      String brokerUrl;
  
      @Value("${jsa.activemq.borker.username}")
      String userName;
  
      @Value("${jsa.activemq.borker.password}")
      String password;
  
      /*
       * Initial ConnectionFactory
       */
      @Bean
      public ConnectionFactory connectionFactory(){
          ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
          connectionFactory.setBrokerURL(brokerUrl);
          connectionFactory.setUserName(userName);
          connectionFactory.setPassword(password);
          connectionFactory.setTrustAllPackages(true);
          return connectionFactory;
      }
  
      @Bean // Serialize message content to json using TextMessage
      public MessageConverter jacksonJmsMessageConverter() {
          MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
          converter.setTargetType(MessageType.OBJECT);
          converter.setTypeIdPropertyName("id");
          return converter;
      }
  
      /*
       * Used for Receiving Message
       */
      @Bean
      public JmsListenerContainerFactory&lt;?&gt; jsaFactory(ConnectionFactory connectionFactory,
                                                      DefaultJmsListenerContainerFactoryConfigurer configurer) {
          DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
          factory.setMessageConverter(jacksonJmsMessageConverter());
          configurer.configure(factory, connectionFactory);
          return factory;
      }
  
          /*
       * Used for Sending Messages.
       */
      @Bean
      public JmsTemplate jmsTemplate(){
          JmsTemplate template = new JmsTemplate();
          template.setConnectionFactory(connectionFactory());
          return template;
      }
  </code></pre>
  
  <p>Active MQ config is same in both Publisher and Listener side. I have registered the message converter but I am not sure why the covertion from JSON to object is not working. Any pointers to solve this issue is appreciated.</p>