java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5>

Spring JIRA | Ralph Schaer | 3 years ago
  1. 0

    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

    Spring JIRA | 3 years ago | Ralph Schaer
    java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5>
  2. 0

    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

    Spring JIRA | 3 years ago | Ralph Schaer
    java.lang.IllegalStateException: Unable to find decoder for type <javax.websocket.PongMessage> used in <org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$5>
  3. 0

    Spring XD 1.1 container will throw following exception: {code} java.lang.IllegalStateException: Can't find class used for type of option 'myField': String at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.makeSimpleModuleOptions(DefaultModuleOptionsMetadataResolver.java:147) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolveNormalMetadata(DefaultModuleOptionsMetadataResolver.java:202) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolve(DefaultModuleOptionsMetadataResolver.java:164) at org.springframework.xd.module.options.DelegatingModuleOptionsMetadataResolver.resolve(DelegatingModuleOptionsMetadataResolver.java:44) at org.springframework.xd.module.options.EnvironmentAwareModuleOptionsMetadataResolver.resolve(EnvironmentAwareModuleOptionsMetadataResolver.java:127) at org.springframework.xd.dirt.stream.XDStreamParser.parse(XDStreamParser.java:174) at org.springframework.xd.dirt.stream.AbstractDeployer.save(AbstractDeployer.java:96) ... {code} when module properties have a trailing whitespace character in type property (in example below there is a trailing space in options.myField.type value): {code} options.myField.description = this is my field options.myField.type = String {code} Can the property values be trimmed before comparing to DefaultModuleOptionsMetadataResolver#SHORT_CLASSNAMES map to avoid this problem?

    Spring JIRA | 2 years ago | Karol Dowbecki
    java.lang.IllegalStateException: Can't find class used for type of option 'myField': String
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring XD 1.1 container will throw following exception: {code} java.lang.IllegalStateException: Can't find class used for type of option 'myField': String at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.makeSimpleModuleOptions(DefaultModuleOptionsMetadataResolver.java:147) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolveNormalMetadata(DefaultModuleOptionsMetadataResolver.java:202) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolve(DefaultModuleOptionsMetadataResolver.java:164) at org.springframework.xd.module.options.DelegatingModuleOptionsMetadataResolver.resolve(DelegatingModuleOptionsMetadataResolver.java:44) at org.springframework.xd.module.options.EnvironmentAwareModuleOptionsMetadataResolver.resolve(EnvironmentAwareModuleOptionsMetadataResolver.java:127) at org.springframework.xd.dirt.stream.XDStreamParser.parse(XDStreamParser.java:174) at org.springframework.xd.dirt.stream.AbstractDeployer.save(AbstractDeployer.java:96) ... {code} when module properties have a trailing whitespace character in type property (in example below there is a trailing space in options.myField.type value): {code} options.myField.description = this is my field options.myField.type = String {code} Can the property values be trimmed before comparing to DefaultModuleOptionsMetadataResolver#SHORT_CLASSNAMES map to avoid this problem?

    Spring JIRA | 2 years ago | Karol Dowbecki
    java.lang.IllegalStateException: Can't find class used for type of option 'myField': String
  6. 0

    Attached is module properties file. Both custom Java classes referenced in the properties are available in the JAR file under _SPRING_XD_HOME/xd/module/<the-module>/lib_ directory. Following exception is thrown: {code}6:26:03,064 1.0.2.RELEASE ERROR http-nio-9393-exec-4 rest.RestControllerAdvice - Caught exception while handling a request java.lang.IllegalStateException: Can't find class used for type of option 'binding': com.emc.it.ds.rtd.springxd.binding.BindingStrategy at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.makeSimpleModuleOptions(DefaultModuleOptionsMetadataResolver.java:137) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolveNormalMetadata(DefaultModuleOptionsMetadataResolver.java:193) at org.springframework.xd.module.options.DefaultModuleOptionsMetadataResolver.resolve(DefaultModuleOptionsMetadataResolver.java:154) at org.springframework.xd.module.options.DelegatingModuleOptionsMetadataResolver.resolve(DelegatingModuleOptionsMetadataResolver.java:44) at org.springframework.xd.module.options.EnvironmentAwareModuleOptionsMetadataResolver.resolve(EnvironmentAwareModuleOptionsMetadataResolver.java:127) at org.springframework.xd.dirt.stream.XDStreamParser.parse(XDStreamParser.java:173) at org.springframework.xd.dirt.stream.AbstractDeployer.save(AbstractDeployer.java:95) at org.springframework.xd.dirt.rest.XDController.save(XDController.java:223) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:280) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:89) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745){code} Please see attached patch file, this seems to be enough to resolve the problem.

    Spring JIRA | 2 years ago | Karol Dowbecki
    java.lang.IllegalStateException: Can't find class used for type of option 'binding': com.emc.it.ds.rtd.springxd.binding.BindingStrategy

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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()
    2. Jetty
      JsrSession.addMessageHandler
      1. org.eclipse.jetty.websocket.jsr356.JsrSession.addMessageHandler(JsrSession.java:113)[javax-websocket-client-impl-9.1.0.v20131115.jar:9.1.0.v20131115]
      1 frame
    3. Spring WebSocket
      StandardWebSocketHandlerAdapter.onOpen
      1. org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93)[spring-websocket-4.0.0.RELEASE.jar:4.0.0.RELEASE]
      1 frame