java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I created a simple websocket client application that uses this configuration. {code:java} @Configuration public class Client { @Bean public WebSocketClient webSocketClient() { return new StandardWebSocketClient(); } @Bean public ClientWebSocketHandler clientWebSocketHandler() { return new ClientWebSocketHandler(); } @Bean public WebSocketConnectionManager webSocketConnectionManager(WebSocketClient webSocketClient, WebSocketHandler webSocketHandler) { WebSocketConnectionManager manager = new WebSocketConnectionManager(webSocketClient, webSocketHandler, "ws://localhost:8080/dispatcher/quotes"); manager.setAutoStartup(true); return manager; } public static void main(String[] args) throws InterruptedException { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Client.class); TimeUnit.MINUTES.sleep(1); } } {code} The ClientWebSocketHandler is a subclass of BinaryWebSocketHandler and listens for incoming data. The server is also a spring application running on Tomcat 7.0.47 and is periodically sending data. I tested this with different JSR 356 implementations. Tyrus: org.glassfish.tyrus.bundles:tyrus-standalone-client:1.3.3 Tomcat 7 org.apache.tomcat:tomcat7-websocket:7.0.47 Tomcat 8 org.apache.tomcat:tomcat-websocket:8.0.0-RC5 org.apache.tomcat:tomcat-coyote:8.0.0-RC5 The Jetty 9.1 native WebSocket implementation works fine too. Had to replace StandardWebSocketClient with JettyWebSocketClient. org.eclipse.jetty.websocket:websocket-client:9.1.0.v20131115 The only problem I have is with Jetty 9.1 and their JSR 356 implementation org.eclipse.jetty.websocket:javax-websocket-client-impl:9.1.0.v20131115 When I start the application it throws this exception {code} 08:37:27.520 [WebSocketClient@347453747-18] WARN o.e.j.w.j.e.JsrEndpointEventDriver - Uncaught exception java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5> at org.eclipse.jetty.websocket.jsr356.JsrSession.addMessageHandler(JsrSession.java:113) ~[javax-websocket-client-impl-9.1.0.v20131115.jar:9.1.0.v20131115] at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93) ~[spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE] {code} But after that exception the application works without any further problems. Complete source code of the example is hosted on GitHub Server: https://github.com/ralscha/playground/tree/master/springwebsocket Client: https://github.com/ralscha/playground/tree/master/springwebsocketclient
    via by Ralph Schaer,
  • I created a simple websocket client application that uses this configuration. {code:java} @Configuration public class Client { @Bean public WebSocketClient webSocketClient() { return new StandardWebSocketClient(); } @Bean public ClientWebSocketHandler clientWebSocketHandler() { return new ClientWebSocketHandler(); } @Bean public WebSocketConnectionManager webSocketConnectionManager(WebSocketClient webSocketClient, WebSocketHandler webSocketHandler) { WebSocketConnectionManager manager = new WebSocketConnectionManager(webSocketClient, webSocketHandler, "ws://localhost:8080/dispatcher/quotes"); manager.setAutoStartup(true); return manager; } public static void main(String[] args) throws InterruptedException { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Client.class); TimeUnit.MINUTES.sleep(1); } } {code} The ClientWebSocketHandler is a subclass of BinaryWebSocketHandler and listens for incoming data. The server is also a spring application running on Tomcat 7.0.47 and is periodically sending data. I tested this with different JSR 356 implementations. Tyrus: org.glassfish.tyrus.bundles:tyrus-standalone-client:1.3.3 Tomcat 7 org.apache.tomcat:tomcat7-websocket:7.0.47 Tomcat 8 org.apache.tomcat:tomcat-websocket:8.0.0-RC5 org.apache.tomcat:tomcat-coyote:8.0.0-RC5 The Jetty 9.1 native WebSocket implementation works fine too. Had to replace StandardWebSocketClient with JettyWebSocketClient. org.eclipse.jetty.websocket:websocket-client:9.1.0.v20131115 The only problem I have is with Jetty 9.1 and their JSR 356 implementation org.eclipse.jetty.websocket:javax-websocket-client-impl:9.1.0.v20131115 When I start the application it throws this exception {code} 08:37:27.520 [WebSocketClient@347453747-18] WARN o.e.j.w.j.e.JsrEndpointEventDriver - Uncaught exception java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5> at org.eclipse.jetty.websocket.jsr356.JsrSession.addMessageHandler(JsrSession.java:113) ~[javax-websocket-client-impl-9.1.0.v20131115.jar:9.1.0.v20131115] at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93) ~[spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE] {code} But after that exception the application works without any further problems. Complete source code of the example is hosted on GitHub Server: https://github.com/ralscha/playground/tree/master/springwebsocket Client: https://github.com/ralscha/playground/tree/master/springwebsocketclient
    via by Ralph Schaer,
    • java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5> at org.eclipse.jetty.websocket.jsr356.JsrSession.addMessageHandler(JsrSession.java:113)[javax-websocket-client-impl-9.1.0.v20131115.jar:9.1.0.v20131115] at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93)[spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE]
    No Bugmate found.