【发布时间】:2014-12-18 08:15:25
【问题描述】:
大家好,在使用 Websocket 和 Tomcat8 时出现以下错误。
java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1092)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textStart(WsRemoteEndpointImplBase.java:1055)
at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:186)
at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37)
at com.iri.monitor.webSocket.IRIMonitorSocketServlet.broadcastData(IRIMonitorSocketServlet.java:369)
at com.iri.monitor.webSocket.IRIMonitorSocketServlet.access$0(IRIMonitorSocketServlet.java:356)
at com.iri.monitor.webSocket.IRIMonitorSocketServlet$5.run(IRIMonitorSocketServlet.java:279)
【问题讨论】:
-
然后你做那个叫做研究的工程工作,在这种情况下,首先将那个错误复制/粘贴到谷歌中。毫不奇怪,搜索结果列表不为空,并且包括现有的堆栈溢出问题,例如:stackoverflow.com/questions/22257079/…
-
这意味着您正在尝试写入 websocket,而前一条消息尚未完成传输。因此它会导致异常。
-
看起来这是此错误报告中提到的 tomcat 行为:bz.apache.org/bugzilla/show_bug.cgi?id=56026