Question

I have registered handler for the SockJS service as

@Bean
public SimpleUrlHandlerMapping handlerMapping() {
SockJsService sockJsService = new DefaultSockJsService(sockJsTaskScheduler());
Map<String, Object> urlMap = new HashMap<String, Object>();
urlMap.put("/sockjs/cobrowse/agent/**", new SockJsHttpRequestHandler(sockJsService,   coBrowseSockJsAgentHandler()));
urlMap.put("/sockjs/cobrowse/customer/**", new SockJsHttpRequestHandler(sockJsService, coBrowseSockJsCustomerHandler()));
urlMap.put("/sockjs/cobrowse/admin/**", new SockJsHttpRequestHandler(sockJsService, coBrowseSockJsAdminHandler()));
SimpleUrlHandlerMapping hm = new SimpleUrlHandlerMapping();
hm.setOrder(-1);
hm.setUrlMap(urlMap);
return hm;
}

But when I try calling from client using one of registered URLs, it throws an exception!

org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator - ERROR -  Closing due to exception for SockJS session id=8cf_1l_6
java.lang.IllegalArgumentException: WebSocketHandler not found for SockJS session id=8cf_1l_6
at org.springframework.util.Assert.isTrue(Assert.java:65)
at org.springframework.web.socket.support.PerConnectionWebSocketHandler.getHandler(PerConnectionWebSocketHandler.java:91)
at org.springframework.web.socket.support.PerConnectionWebSocketHandler.handleTransportError(PerConnectionWebSocketHandler.java:97)
at org.springframework.web.socket.support.ExceptionWebSocketHandlerDecorator.handleTransportError(ExceptionWebSocketHandlerDecorator.java:79)
at org.springframework.web.socket.support.WebSocketHandlerDecorator.handleTransportError(WebSocketHandlerDecorator.java:64)
at org.springframework.web.socket.support.LoggingWebSocketHandlerDecorator.handleTransportError(LoggingWebSocketHandlerDecorator.java:66)
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateError(AbstractSockJsSession.java:188)
at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.tryCloseWithSockJsTransportError(AbstractSockJsSession.java:255)
at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.initializeDelegateSession(WebSocketServerSockJsSession.java:122)
at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.afterConnectionEstablished(SockJsWebSocketHandler.java:72)
at org.springframework.web.socket.adapter.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:93)
at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:130)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:653)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1584)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1543)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

This is even more surprising because same code was running till yesterday -No major changes on my side. My guess is, it's something to do with spring jars, may be nightly update -I am using "4.0.0.BUILD-SNAPSHOT", but then I do not have previous libs!

Posting it here, if someone have came across this, meanwhile I am trying to get hold of old libs to try out - i do not know how to get it from official repo (Older version of same release!).

Was it helpful?

Solution

I spend couple of hours comparing my code against repository and tried to figure out what went wrong -when I was confident enough that I have not broken anything, I guessed that it might be that its due to the latest JAR. I use maven so my repo got updated today morning. Since libs are from Spring -this guess has to com last!

My guess turned out to be correct -when I replaced current version "4.0.0.BUILD-20130823.020236" with an earlier one which is "4.0.0.BUILD-20130814.154539-172" -Issue got resolved. Thanks a lot microsoft recycle bin!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top