org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=byte[0], headers={simpMessageType=DISCONNECT, stompCommand=DISCONNECT, simpSessionAttributes={org.springframework.messaging.simp.SimpAttributes.COMPLETED=true}, simpSessionId=e4fb909754d849a08526503c2afa7584}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@329d23a5 in StompBrokerRelay[127.0.0.1:61613]; nested exception is java.lang.NullPointerException

Spring JIRA | Prashant Deva | 5 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    This is the exception on server {code} Exception in thread "clientInboundChannel-97" org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=byte[0], headers={simpMessageType=DISCONNECT, stompCommand=DISCONNECT, simpSessionAttributes={org.springframework.messaging.simp.SimpAttributes.COMPLETED=true}, simpSessionId=e4fb909754d849a08526503c2afa7584}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@329d23a5 in StompBrokerRelay[127.0.0.1:61613]; nested exception is java.lang.NullPointerException at org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:144) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler$StompConnectionHandler.forward(StompBrokerRelayMessageHandler.java:783) at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.handleMessageInternal(StompBrokerRelayMessageHandler.java:511) at org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler.handleMessage(AbstractBrokerMessageHandler.java:238) at org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:135) ... 3 more {code} Here is the client side code: {code:java} void setup() throws ExecutionException, InterruptedException { JettyWebSocketClient webSocketClient = new JettyWebSocketClient(); List<Transport> transports = new ArrayList<Transport>(1); transports.add(new WebSocketTransport(webSocketClient)); SockJsClient sockJsClient = new SockJsClient(transports); sockJsClient.setMessageCodec(new StringMessageCodec()); stompClient = new WebSocketStompClient(sockJsClient); stompClient.setMessageConverter(new StringMessageConverter()); stompClient.start(); sessionHandler = new MyStompSessionHandler(); stompClient.connect(WS_URL, sessionHandler); } void stop() { stompSession.disconnect(); stompClient.stop(); } {code} As you can see the client closes the connection gracefully. It first disconnects the session and then calls stop() on the stompClient. Doing so should not result in an exception on the server.

    Spring JIRA | 5 months ago | Prashant Deva
    org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=byte[0], headers={simpMessageType=DISCONNECT, stompCommand=DISCONNECT, simpSessionAttributes={org.springframework.messaging.simp.SimpAttributes.COMPLETED=true}, simpSessionId=e4fb909754d849a08526503c2afa7584}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@329d23a5 in StompBrokerRelay[127.0.0.1:61613]; nested exception is java.lang.NullPointerException
  2. 0

    Spring websocket user message noSimpl

    Stack Overflow | 9 months ago | Rafik991
    org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=byte[22], headers={simpMessageType=MESSAGE, nativeHeaders={destination=[/app/hello], content-length=[22]}, simpUser=org.springframework.security.authentication.UsernamePasswordAuthenticationToken@bbe3d74f: Principal: SessionUser{userId=123}; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffed504: RemoteIpAddress: 127.0.0.1; SessionId: 1w2b0r1yl8c90kdq8uwvut4pp; Granted Authorities: ROLE_USER, contentType=application/json;charset=UTF-8, simpSessionId=fd85da400d32427d941c113a191277da, simpDestination=/app/hello}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@170caf41 in WebSocketAnnotationMethodMessageHandler[prefixes=[/app/, /user/]]; nested exception is java.lang.IllegalStateException: No session attributes in GenericMessage [payload=byte[22], headers={simpMessageType=MESSAGE, nativeHeaders={destination=[/app/hello], content-length=[22]}, simpUser=org.springframework.security.authentication.UsernamePasswordAuthenticationToken@bbe3d74f: Principal: SessionUser{userId=123}; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffed504: RemoteIpAddress: 127.0.0.1; SessionId: 1w2b0r1yl8c90kdq8uwvut4pp; Granted Authorities: ROLE_USER, contentType=application/json;charset=UTF-8, lookupDestination=/hello, simpSessionId=fd85da400d32427d941c113a191277da, simpDestination=/app/hello}]
  3. 0

    Adding sleuth dependency breaking the websocket subscribe flow

    GitHub | 9 months ago | PreetamMyneni
    org.springframework.messaging.MessageDeliveryException: Failed to handle GenericMessage [payload=byte[0], headers={simpMessageType=CONNECT, stompCommand=CONNECT, nativeHeaders={accept-version=[1.1,1.0], heart-beat=[10000,10000], X-B3-SpanId=[cb05e82b4a3fe89c], X-B3-Sampled=[0], X-B3-TraceId=[cb05e82b4a3fe89c]}, simpSessionAttributes={}, X-B3-SpanId=cb05e82b4a3fe89c, simpHeartbeat=[J@101cc820, X-B3-Sampled=0, X-B3-TraceId=cb05e82b4a3fe89c, id=4055ce24-b0c8-3340-e099-69c24d9d7d02, X-Current-Span=[Trace: cb05e82b4a3fe89c, Span: cb05e82b4a3fe89c, exportable=false], simpSessionId=m2kccjuq, timestamp=1463599267150}] to org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask@1edb2453 in SimpleBrokerMessageHandler [DefaultSubscriptionRegistry[cache[0 destination(s)], registry[0 sessions]]]; nested exception is java.lang.IllegalStateException: No header accessor (not using the SimpMessagingTemplate?): GenericMessage [payload=byte[0], headers={simpMessageType=CONNECT, stompCommand=CONNECT, nativeHeaders={accept-version=[1.1,1.0], heart-beat=[10000,10000], X-B3-SpanId=[cb05e82b4a3fe89c], X-B3-Sampled=[0], X-B3-TraceId=[cb05e82b4a3fe89c]}, simpSessionAttributes={}, X-B3-SpanId=cb05e82b4a3fe89c, simpHeartbeat=[J@101cc820, X-B3-Sampled=0, X-B3-TraceId=cb05e82b4a3fe89c, id=4055ce24-b0c8-3340-e099-69c24d9d7d02, X-Current-Span=[Trace: cb05e82b4a3fe89c, Span: cb05e82b4a3fe89c, exportable=false], simpSessionId=m2kccjuq, timestamp=1463599267150}]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    1 unregistered visitors

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler$StompConnectionHandler.forward()
    2. Spring Messaging
      ExecutorSubscribableChannel$SendTask.run
      1. org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler$StompConnectionHandler.forward(StompBrokerRelayMessageHandler.java:783)
      2. org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.handleMessageInternal(StompBrokerRelayMessageHandler.java:511)
      3. org.springframework.messaging.simp.broker.AbstractBrokerMessageHandler.handleMessage(AbstractBrokerMessageHandler.java:238)
      4. org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:135)
      4 frames
    3. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames