spring-projects / spring-session

Spring Session
https://spring.io/projects/spring-session
Apache License 2.0
1.86k stars 1.12k forks source link

NullPointerException while registering WebSocket session #630

Open bilak opened 8 years ago

bilak commented 8 years ago

Hello, this is my testing project. I'd like to setup services stack with gateway service, authorization(uaa) service and api service. Api service is used to provide rest/websocket api. Now I'd like to join http session with web socket session to be able to test session timeouts. When I try to create websocket session I'm getting following exception.

java.lang.NullPointerException: null
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) ~[na:1.8.0_77]
    at org.springframework.session.web.socket.handler.WebSocketRegistryListener.registerWsSession(WebSocketRegistryListener.java:118) ~[spring-session-1.2.1.RELEASE.jar:na]
    at org.springframework.session.web.socket.handler.WebSocketRegistryListener.afterConnectionEstablished(WebSocketRegistryListener.java:86) ~[spring-session-1.2.1.RELEASE.jar:na]
    at org.springframework.session.web.socket.handler.WebSocketRegistryListener.onApplicationEvent(WebSocketRegistryListener.java:67) ~[spring-session-1.2.1.RELEASE.jar:na]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336) ~[spring-context-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    at org.springframework.session.web.socket.handler.WebSocketConnectHandlerDecoratorFactory$SessionWebSocketHandler.publishEvent(WebSocketConnectHandlerDecoratorFactory.java:84) [spring-session-1.2.1.RELEASE.jar:na]
    at org.springframework.session.web.socket.handler.WebSocketConnectHandlerDecoratorFactory$SessionWebSocketHandler.afterConnectionEstablished(WebSocketConnectHandlerDecoratorFactory.java:78) [spring-session-1.2.1.RELEASE.jar:na]
    at org.springframework.web.socket.handler.WebSocketHandlerDecorator.afterConnectionEstablished(WebSocketHandlerDecorator.java:70) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.afterConnectionEstablished(LoggingWebSocketHandlerDecorator.java:48) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator.afterConnectionEstablished(ExceptionWebSocketHandlerDecorator.java:48) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.delegateConnectionEstablished(AbstractSockJsSession.java:374) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.sockjs.transport.session.WebSocketServerSockJsSession.initializeDelegateSession(WebSocketServerSockJsSession.java:159) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.sockjs.transport.handler.SockJsWebSocketHandler.afterConnectionEstablished(SockJsWebSocketHandler.java:87) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.onOpen(StandardWebSocketHandlerAdapter.java:100) [spring-websocket-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:133) [tomcat-embed-websocket-8.5.4.jar:8.5.4]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:827) [tomcat-embed-core-8.5.4.jar:8.5.4]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425) [tomcat-embed-core-8.5.4.jar:8.5.4]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.4.jar:8.5.4]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.4.jar:8.5.4]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]

If you need more informations let me know.

Thanks

panchenko commented 8 years ago

This must be a duplicate of #561 (based on the identical stacktrace).

bilak commented 8 years ago

@panchenko that looks promissing, thank you