title: Spring JMS MappingJackson2MessageConverter - No way to handle errors
body: <p>I am using Spring JMS with ActiveMQ, and I am using the <code>MappingJackson2MessageConverter</code> to pass along messages between various components.</p>
  <p>My core problem is that when the <code>MappingJackson2MessageConverter</code> experiences an internal deserialization error, when deserializing a String into some Object, these exceptions are not raised in any way that I can respond to them. My Error Handler logic never gets called, and no exceptions are thrown that I have access to. These deserialization errors appear to be completely swallowed and, while they are logged in the console, I am offered no chance to perform custom logic in response to them.</p>
  <p>I define my <code>MappingJackson2MessageConverter</code> bean as follows:</p>
  <pre><code>  @Bean
    public MessageConverter jacksonJmsMessageConverter() {
      MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
      converter.setTargetType(MessageType.TEXT);
      converter.setTypeIdPropertyName(&quot;_type&quot;);
      return converter;
    }
  </code></pre>
  <p>I define a JMS Listener factory as follows:</p>
  <pre><code>  @Bean
    public JmsListenerContainerFactory&lt;?&gt; jmsListenerQueueFactory(ConnectionFactory connectionFactory,
        DefaultJmsListenerContainerFactoryConfigurer configurer, JmsErrorHandler jmsErrorHandler) {
      DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
      factory.setErrorHandler(jmsErrorHandler); // &lt;-- I expect this to be used
      configurer.configure(factory, connectionFactory);
  
      return factory;
    }
  </code></pre>
  <p>Of importance in the above line is the <code>setErrorHandler</code> call. I have defined a simple <code>ErrorHandler</code> object that is attempting to catch errors that my <code>@JmsListener</code> methods may throw. This simple error handler looks like this:</p>
  <pre><code>  public class JmsErrorHandler implements ErrorHandler {
  
    @Override
    public void handleError(Throwable t) {
      System.out.println(&quot;WE HAVE THE ERROR!&quot;);
    }
  }
  </code></pre>
  <p>My listener is also simple, as follows:</p>
  <pre><code>  @JmsListener(id = MY_ID, destination = MY_DEST)
    public void processMessage(MyPojoMessage myPojoMessage) {
       // This code is obviously never reached, since the serialization error occurs. 
  </code></pre>
  <p>Overall, this is a very simple and basic setup. Now when I send an invalid message, that Jackson will <em>fail</em> to parse, I get the following errors in my console:</p>
  <pre><code>19-10-2020 09:05:33.933 [35m[DefaultMessageListenerContainer-1][0;39m [31mWARN [0;39m o.s.j.l.DefaultMessageListenerContainer.invokeErrorHandler - Execution of JMS message listener failed, and no ErrorHandler has been set.
  
  org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method 'public void com.example.processMessage(com.example.MyPojoMessage)' threw exception; nested exception is org.springframework.jms.support.converter.MessageConversionException: Failed to convert JSON message content; nested exception is com.fasterxml.jackson.databind.JsonMappingException
  </code></pre>
  <p>This exception is expected - since I provide an invalid payload that Jackson cannot serialize. However, there is seemingly <em>no way</em> for me to configure the code to actually catch this exception in a way I can respond to it. I am setting the Error Handler in the above code. Yet the logs complain that <code>no ErrorHandler has been set</code> which seems wrong.</p>
  <p>I see no other ways to get a reference to this Jackson inner exception. Is there any way?</p>