title: Exception Exception is not compatible with throws clause in SpringAMQPMessageSource.onMessage(Message, Channel) Axon
body: <p>I am working on Spring Boot + Axon Framework developing demo explain here: <a href="https://www.youtube.com/watch?v=Jp-rW-XOYzA&amp;list=PLgGXSWYM2FpOa_FTla-x5Wd10dpmgrRC4&amp;index=54" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Jp-rW-XOYzA&amp;list=PLgGXSWYM2FpOa_FTla-x5Wd10dpmgrRC4&amp;index=54</a>. In this example I am only using latest dependencies, other stuff I keep the as is.</p>
  
  <p>When I simply run the code I get the below error and already something wrong here at line.  Please guide me.</p>
  
  <p>Error:-</p>
  
  <pre><code>java.lang.Error: Unresolved compilation problem: 
      Exception Exception is not compatible with throws clause in SpringAMQPMessageSource.onMessage(Message, Channel)
  
      at com.example.DemoComplaintsStatsApplication$1.onMessage(DemoComplaintsStatsApplication.java:54) ~[classes/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_151]
      at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_151]
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
      at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114) ~[spring-messaging-5.0.10.RELEASE.jar:5.0.10.RELEASE]
      at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:51) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:188) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:126) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1414) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1337) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1324) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1303) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:817) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:801) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:77) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1042) ~[spring-rabbit-2.0.8.RELEASE.jar:2.0.8.RELEASE]
      at java.lang.Thread.run(Unknown Source) [na:1.8.0_151]
  </code></pre>
  
  <p><strong>DemoComplaintsStatsApplication.java</strong></p>
  
  <pre><code>@SpringBootApplication
  public class DemoComplaintsStatsApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(DemoComplaintsStatsApplication.class, args);
      }
  
  
      @ProcessingGroup("amqpEvents")
      @RestController
      public static class ComplaintStatisticsAPI {
  
          private ConcurrentMap&lt;String, AtomicLong&gt; staticstics = new ConcurrentHashMap&lt;&gt;();
  
          @EventHandler
          public void on(ComplaintFileEvent event) {
              staticstics.computeIfAbsent(event.getCompany(), k -&gt; new AtomicLong()).incrementAndGet();
          }
  
          @GetMapping
          public Map&lt;String, AtomicLong&gt; getStatistics(){
              return staticstics;
          }
      }
  
      @Bean
      public SpringAMQPMessageSource complaintEvents(Serializer serializer) {
          return new SpringAMQPMessageSource(new DefaultAMQPMessageConverter(serializer)) {
  
              @RabbitListener(queues = "ComplaintEvents")
              @Override
              public void onMessage(Message message, Channel channel) throws Exception {
                  super.onMessage(message, channel);
              }
          };
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Xaf9f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xaf9f.png" alt="enter image description here"></a></p>