m0_37487097
阎小孩儿
采纳率0%
2017-05-07 14:24 阅读 3.6k

spring websocket报如下错误,请问是什么问题?

 7-May-2017 22:13:18.552 严重 [http-nio-8080-exec-3] org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.handleMessage Broken data received. Terminating WebSocket connection abruptly
 java.lang.IllegalStateException: A SockJsMessageCodec is required but not available: Add Jackson to the classpath, or configure a custom SockJsMessageCodec.
    at org.springframework.util.Assert.state(Assert.java:70)
    at org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.getMessageCodec(TransportHandlingSockJsService.java:134)
    at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.handleMessage(WebSocketServerSockJsSession.java:186)
    at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.handleTextMessage(SockJsWebSocketHandler.java:92)
    at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43)
    at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:110)
    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:81)
    at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:78)
    at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:389)
    at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:110)
    at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:489)
    at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:288)
    at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:127)
    at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:73)
    at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
    at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1368)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • mybook201314 天涯共明月 2017-05-08 01:00

    应该是缺少Jackson jar包 的问题

     <dependency>  
        <groupId>com.fasterxml.jackson.core</groupId>  
        <artifactId>jackson-core</artifactId>  
        <version>2.3.0</version>  
    </dependency>  
    <dependency>  
        <groupId>com.fasterxml.jackson.core</groupId>  
        <artifactId>jackson-databind</artifactId>  
        <version>2.3.0</version>  
    </dependency>
    
    点赞 评论 复制链接分享
  • yaisiy Neomi 2017-08-29 07:42

    楼主问题解决了吗?我也碰到这个问题

    点赞 评论 复制链接分享

相关推荐