title: org.springframework.messaging.converter.MessageConversionException: Cannot convert
body: <p>We have an application using Spring Boot and Tibco EMS JMS implementations. When I create the war and deploy on my local Tomcat, I can send and receive the messages with no issues. However, if I run the application from main() method:</p>
  
  <pre><code>@SpringBootApplication
  public class Main {
   public static void main(String[] args) {       
      SpringApplication.run(Main.class, args);
   }
  }
  </code></pre>
  
  <p>As Run as> Spring Boot App, I see this error as soon as the message is sent to be consumed. </p>
  
  <p>This is where the messages is created and sent:</p>
  
  <pre><code>@Transactional
  private void sendAndLog (Long id1, Long id2, String s, List&lt;Mapping&gt; mappings) {
      queue.send(new Request (
              id1,
              id2,
              s,
              mappings));
      log.info("Message sent.");
  }
  </code></pre>
  
  <p>This is where its consumed - I see that error right after send() is called and never get to the receive() method:</p>
  
  <pre><code>Processor.java:
  
  @Transactional
  public void receive (Request mappings) {
      // Process the message
  }
  </code></pre>
  
  <p>This is the Request class:</p>
  
  <pre><code>public class Request implements Serializable {
      private static final long serialVersionUID = 1L;
  
      private Long id1;
      private Long id2;   
      private String s;   
      private List&lt;Mapping&gt; mappings;
  
      public Request() {}
      public Request (Long id1, Long id2, String s, List&lt;Mapping&gt; mappings) {
          this.id1 = id1;
          this.id2 = id2;
          this.s = s;
          this.mappings = mappings;
      }
  
      //getter() and setter() methods.
  }
  </code></pre>
  
  <p>This is the error.</p>
  
  <p>What goes wrong and why I'm seeing this error "only" when run with Spring Runner and not when deployed to Tomcat?</p>
  
  <pre><code>2018-07-25 17:19:19.924  WARN 4796 --- [enerContainer-7] o.s.j.l.DefaultMessageListenerContainer  : Execution of JMS message listener failed, and no ErrorHandler has been set.
  
  org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method could not be invoked with incoming message
  Endpoint handler details:
  Method [public void com.package.tasks.Processor.receive(com.package.dto.Request)]
  Bean [com.package.tasks.Processor@475d2a6d]
  ; nested exception is org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.package.dto.Request] to [com.package.dto.Request] for org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter$LazyResolutionMessage@6d5d2920, failedMessage=org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter$LazyResolutionMessage@6d5d2920
      at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:118)
      at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:77)
      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.lang.Thread.run(Unknown Source)
  Caused by: org.springframework.messaging.converter.MessageConversionException: Cannot convert from [com.package.dto.Request] to [com.package.dto.Request] for org.springframework.jms.listener.adapter.AbstractAdaptableMessageListener$MessagingMessageConverterAdapter$LazyResolutionMessage@6d5d2920
      at org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver.resolveArgument(PayloadArgumentResolver.java:144)
      at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:114)
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:137)
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:109)
      at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:114)
      ... 10 common frames omitted
  
  17:19:19.924 [DefaultMessageListenerContainer-7] WARN  o.s.j.l.DefaultMessageListenerContainer - Execution of JMS message listener failed, and no ErrorHandler has been set.
  </code></pre>