title: How to fix the problem of " Unhandled exception from message handler method " for chatbox using springboot
body: <p>I am trying to build chat box using springboot+thymeleaf in java.I am having an error for sending a call from UI to controller. Whenever I enter the username and click on send it gives an error saying <code>Unhandled exception from message handler method</code>. 
  I have downloaded the chatbox code from online and I have integerated the code with my existing project.If I run the project independently it works perfectly fine but if I integrate with my project it gives me the error.</p>
  
  <p>My .js has the below method which call chat.addUser.</p>
  
  <p><strong>Main.js</strong>  </p>
  
  <pre><code>function onConnected() {
  
          stompClient.subscribe('/topic/publicChatRoom', onMessageReceived); // Subscribe to the Public Topic
  
          // Tell your username to the server
          stompClient.send("/app/chat.addUser",
              {},
              JSON.stringify({sender: username, type: 'JOIN'})
          )
  
          connectingElement.classList.add('hidden');
      }
  </code></pre>
  
  <p>My WebSocketChatController look like this</p>
  
  <p><strong>WebSocketController.java</strong>  </p>
  
  <pre><code>    @MessageMapping("/chat.addUser")
      @SendTo("/topic/publicChatRoom")
      public ChatMessage addUser(@Payload ChatMessage chatMessage,SimpMessageHeaderAccessor headerAccessor) {
          // Add username in web socket session
          System.out.println("In addUser");
          headerAccessor.getSessionAttributes().put("username",chatMessage.getSender());
          return chatMessage;
      }
  </code></pre>
  
  <p>In this controller I am unable to call (<code>"/chat.addUser"</code>).My output is like this when I enter the username. </p>
  
  <p>Output: </p>
  
  <pre><code>    2019-05-30 17:11:50,228  [34mINFO [0;39m [-8081-exec-6] [36mcom.bmc.app.config.WebLogAspect         [0;39m : RESPONSE : chat 
      2019-05-30 17:11:50,228  [34mINFO [0;39m [-8081-exec-6] [36mcom.bmc.app.config.WebLogAspect         [0;39m : SPEND TIME : 1 
      2019-05-30 17:11:50,228  [34mINFO [0;39m [-8081-exec-6] [36mcom.bmc.app.config.WebLogAspect    [0;39m :
      2019-05-30 17:12:11,853  [34mINFO [0;39m [-8081-exec-2] [36mc.b.a.listener.HttpHandshakeInterceptor [0;39m : Call beforeHandshake 
      2019-05-30 17:12:11,855  [34mINFO [0;39m [-8081-exec-2] [36mc.b.a.listener.HttpHandshakeInterceptor [0;39m : Call afterHandshake 
      2019-05-30 17:12:11,863  [34mINFO [0;39m [undChannel-7] [36mc.b.a.config.WebSocketChatEventListener [0;39m : Received a new web socket connection 
      2019-05-30 17:12:14,899  [1;31mERROR[0;39m [ndChannel-23] [36m.WebSocketAnnotationMethodMessageHandler[0;39m : Unhandled exception from message handler method 
      java.lang.NullPointerException: null
          at com.bmc.app.config.WebLogAspect.doBefore(WebLogAspect.java:33) ~[classes/:na]
          at jdk.internal.reflect.GeneratedMethodAccessor238.invoke(Unknown Source) ~[na:na]
  </code></pre>