qq_39263419
一只正在奋斗的小猪
采纳率0%
2021-03-05 11:12

websocket 建立连接通信时,onError报这样的错咋解决呢

2020-10-14 01:41:18.998 [http-nio-9097-exec-4] ERROR org.apache.tomcat.websocket.pojo.PojoEndpointBase - No error handling configured for [com.qhjys.cloud.android.util.MyWebSocket] and the following error occurred
java.io.EOFException: null
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1259)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1193)
    at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:72)
    at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171)
    at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151)
    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:790)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • technologist_04 CSDN技术专家团—麒麟奇 1月前

    从错误来看,应该是websocket连接断开或者建连失败导致这个错误

    如果是建连失败,检查服务器是否工作正常,程序配置是否正确

    连接断开解决方案:
    1.后台加定时发一个心跳消息
    2.前端在onclose里添加reconnect重新建立连接

    点赞 1 评论 复制链接分享
  • weixin_45213446 减白 1月前

    建议打开我主页, 有专门解决这一错误的博客

    点赞 评论 复制链接分享