I've written a simple Servlet/WebSocket client that sends a message over the Session each time a GET request comes in. This worked a few months ago:
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ClusterMessage message = new ClusterMessage(this.nodeId, "request:{ip:\"" + request.getRemoteAddr() + "\",queryString:\"" + request.getQueryString() + "\"}"); try(OutputStream output = this.session.getBasicRemote().getSendStream(); ObjectOutputStream stream = new ObjectOutputStream(output)) { stream.writeObject(message); } response.getWriter().append("OK"); } But on the latest trunk, I get this error on the first request to doGet: java.lang.IllegalStateException: The remote endpoint was in state [STREAM_WRITING] which is an invalid state for called method org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1014) org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.binaryPartialStart(WsRemoteEndpointImplBase.java:961) org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendPartialBytes(WsRemoteEndpointImplBase.java:140) org.apache.tomcat.websocket.WsRemoteEndpointImplBase$WsOutputStream.doWrite(WsRemoteEndpointImplBase.java:838) org.apache.tomcat.websocket.WsRemoteEndpointImplBase$WsOutputStream.flush(WsRemoteEndpointImplBase.java:821) java.io.ObjectOutputStream$BlockDataOutputStream.flush(ObjectOutputStream.java:1823) java.io.ObjectOutputStream.flush(ObjectOutputStream.java:719) java.io.ObjectOutputStream.close(ObjectOutputStream.java:740) com.wrox.ClusterNodeServlet.doGet(ClusterNodeServlet.java:72) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) On all subsequent requests, I get this error: java.lang.IllegalStateException: The remote endpoint was in state [STREAM_WRITING] which is an invalid state for called method org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1014) org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.streamStart(WsRemoteEndpointImplBase.java:951) org.apache.tomcat.websocket.WsRemoteEndpointImplBase.getSendStream(WsRemoteEndpointImplBase.java:190) org.apache.tomcat.websocket.WsRemoteEndpointBasic.getSendStream(WsRemoteEndpointBasic.java:62) com.wrox.ClusterNodeServlet.doGet(ClusterNodeServlet.java:68) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) I'm guessing I need to file a BZ, but I wanted to make sure. I don't see how I could possibly be doing anything wrong in this simple code. N --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org