org.springframework.messaging.simp.stomp.StompConversionException: Illegal header: 'login:'. A header must be of the form <name>:<value>

Spring JIRA | Prashant Deva | 3 years ago
  1. 0

    All the documentation for spring websockets, including the guide here (http://spring.io/guides/gs/messaging-stomp-websocket/) , show client side code example as: {code} function connect() { var socket = new SockJS('/hello'); stompClient = Stomp.over(socket); stompClient.connect('', '', function(frame) { }); } {code} This is incorrect. {{stompClient.connect}} needs a username and password in the first 2 arguments. Running the {{stompClient}} passing in {{''}} to the {{connect()}} method as shown in the examples, results in an error: {code} Web Socket Opened... stomp.min.js:8 >>> CONNECT login: passcode: accept-version:1.1,1.0 heart-beat:10000,10000 stomp.min.js:8 <<< ERROR message:Illegal header\c 'login\c'. A header must be of the form <name>\c<value> content-length:0 {code} It even leads to this server side exception: {code:java} 17:05:32,369 ERROR http-bio-8080-exec-9 messaging.StompSubProtocolHandler:118 - Failed to parse WebSocket message as STOMP frame org.springframework.messaging.simp.stomp.StompConversionException: Illegal header: 'login:'. A header must be of the form <name>:<value> at org.springframework.messaging.simp.stomp.StompDecoder.readHeaders(StompDecoder.java:129) at org.springframework.messaging.simp.stomp.StompDecoder.decode(StompDecoder.java:69) at org.springframework.web.socket.messaging.StompSubProtocolHandler.handleMessageFromClient(StompSubProtocolHandler.java:108) at org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.handleMessage(SubProtocolWebSocketHandler.java:233) at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:59) at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:55) at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:69) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateMessages(AbstractSockJsSession.java:153) at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.handleMessage(WebSocketServerSockJsSession.java:154) at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.handleTextMessage(SockJsWebSocketHandler.java:77) at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43) at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:112) at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:82) at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:79) at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:376) at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:474) at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:275) at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:116) at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:54) at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:194) at org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:189) at org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:92) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:605) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) {code} One needs to pass the actual user/password to the messaging queue as described in SPR-11435 which leads to a huge security issue

    Spring JIRA | 3 years ago | Prashant Deva
    org.springframework.messaging.simp.stomp.StompConversionException: Illegal header: 'login:'. A header must be of the form <name>:<value>
  2. 0

    Spring Websocket: Failed to parse WebSocket message as STOMP frame

    GitHub | 3 years ago | Ogniute
    org.springframework.messaging.simp.stomp.StompConversionException: Frame must be terminated with a null octet
  3. 0

    Getting error "Failed to parse TextMessage payload=[CONNECT" in STOMP while connecting t

    Stack Overflow | 8 months ago | Zahid Nisar
    org.springframework.messaging.simp.stomp.StompConversionException: Illegal header: ' setConnected(true);'. A header must be of the form <name>:[<value>].
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Failed to parse TextMessage payload=[UNSUBSCRIB..]

    GitHub | 2 months ago | artjas
    org.springframework.messaging.simp.stomp.StompConversionException: Illegal header: ' [native code]'. A header must be of the form <name>:[<value>].
  6. 0

    Spring Framework Stomp Relay - throws StompConversionException highly intermittently and drops connection

    Stack Overflow | 1 year ago | user4497170
    org.springframework.messaging.simp.stomp.StompConversionException: Illegal escape sequence at index 73: ID\cServerName-39727-1442953787927-4\c1\c1\c1\

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.messaging.simp.stomp.StompConversionException

      Illegal header: 'login:'. A header must be of the form <name>:<value>

      at org.springframework.messaging.simp.stomp.StompDecoder.readHeaders()
    2. Spring Messaging
      StompDecoder.decode
      1. org.springframework.messaging.simp.stomp.StompDecoder.readHeaders(StompDecoder.java:129)
      2. org.springframework.messaging.simp.stomp.StompDecoder.decode(StompDecoder.java:69)
      2 frames
    3. Spring WebSocket
      StandardWebSocketHandlerAdapter$3.onMessage
      1. org.springframework.web.socket.messaging.StompSubProtocolHandler.handleMessageFromClient(StompSubProtocolHandler.java:108)
      2. org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.handleMessage(SubProtocolWebSocketHandler.java:233)
      3. org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:59)
      4. org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:55)
      5. org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.handleMessage(ExceptionWebSocketHandlerDecorator.java:69)
      6. org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateMessages(AbstractSockJsSession.java:153)
      7. org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.handleMessage(WebSocketServerSockJsSession.java:154)
      8. org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.handleTextMessage(SockJsWebSocketHandler.java:77)
      9. org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43)
      10. org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:112)
      11. org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42)
      12. org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:82)
      13. org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:79)
      13 frames
    4. Tomcat WS
      WsHttpUpgradeHandler$WsReadListener.onDataAvailable
      1. org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:376)
      2. org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:474)
      3. org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:275)
      4. org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:116)
      5. org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:54)
      6. org.apache.tomcat.websocket.server.WsHttpUpgradeHandler$WsReadListener.onDataAvailable(WsHttpUpgradeHandler.java:194)
      6 frames
    5. org.apache.coyote
      AbstractProcessor.upgradeDispatch
      1. org.apache.coyote.http11.upgrade.AbstractServletInputStream.onDataAvailable(AbstractServletInputStream.java:189)
      2. org.apache.coyote.http11.upgrade.AbstractProcessor.upgradeDispatch(AbstractProcessor.java:92)
      2 frames
    6. Grizzly HTTP
      JIoEndpoint$SocketProcessor.run
      1. org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:605)
      2. org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
      2 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      3. java.lang.Thread.run(Thread.java:744)
      3 frames