[GRIZZLY-1270] NPE when attempting to get the session from a request associated with a websocket. Created: 24/May/12  Updated: 03/Jul/12  Resolved: 29/May/12

Status: Resolved
Project: grizzly
Component/s: websockets
Affects Version/s: 1.9.46, 1.9.47, 1.9.48, 1.9.49
Fix Version/s: 1.9.50

Type: Bug Priority: Major
Reporter: Ryan Lubke Assignee: Ryan Lubke
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Java Archive File grizzly-websockets.jar    

 Description   

From a posting on stackoverflow.com:

INFO: 18:07:19.816 [http-thread-pool-8080(4)] WARN o.a.websocket.WebSocketProcessor - Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NullPointerException: null
at com.sun.grizzly.tcp.http11.GrizzlyRequest.doGetSession(GrizzlyRequest.java:2271) ~[grizzly-utils.jar:1.9.46]
at com.sun.grizzly.tcp.http11.GrizzlyRequest.getSession(GrizzlyRequest.java:2226) ~[grizzly-utils.jar:1.9.46]
at com.sun.grizzly.http.servlet.HttpServletRequestImpl.getSession(HttpServletRequestImpl.java:986) ~[grizzly-http-servlet.jar:1.9.46]
at com.sun.grizzly.http.servlet.HttpServletRequestImpl.getSession(HttpServletRequestImpl.java:1009) ~[grizzly-http-servlet.jar:1.9.46]
at org.atmosphere.cpr.AtmosphereRequest.createSession(AtmosphereRequest.java:606) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereRequest.getSession(AtmosphereRequest.java:580) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereRequest.getSession(AtmosphereRequest.java:600) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.samples.chat.ChatAtmosphereHandler.onRequest(ChatAtmosphereHandler.java:43) ~[ChatAtmosphereHandler.class:na]
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:232) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:165) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.container.GlassFishWebSocketSupport.service(GlassFishWebSocketSupport.java:111) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1125) ~[atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.websocket.WebSocketProcessor.dispatch(WebSocketProcessor.java:183) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.websocket.WebSocketProcessor.dispatch(WebSocketProcessor.java:112) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.atmosphere.container.GlassFishWebSocketSupport$GrizzlyApplication.onConnect(GlassFishWebSocketSupport.java:163) [atmosphere-runtime-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at com.sun.grizzly.websockets.DefaultWebSocket.onConnect(DefaultWebSocket.java:128) [grizzly-websockets.jar:1.9.46]
at com.sun.grizzly.websockets.WebSocketEngine.upgrade(WebSocketEngine.java:188) [grizzly-websockets.jar:1.9.46]
at com.sun.grizzly.websockets.WebSocketAsyncFilter.doFilter(WebSocketAsyncFilter.java:54) [grizzly-websockets.jar:1.9.46]
at com.sun.grizzly.arp.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:171) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.arp.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:143) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:102) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.http.TaskBase.run(TaskBase.java:193) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.http.TaskBase.execute(TaskBase.java:175) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.arp.DefaultAsyncHandler.handle(DefaultAsyncHandler.java:145) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.arp.AsyncProtocolFilter.execute(AsyncProtocolFilter.java:210) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) [grizzly-http.jar:1.9.46]
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.ContextTask.run(ContextTask.java:71) [grizzly-framework.jar:1.9.46]
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) [grizzly-utils.jar:1.9.46]
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) [grizzly-utils.jar:1.9.46]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_03]



 Comments   
Comment by Ryan Lubke [ 29/May/12 ]

Changes applied: ba5194d3

Comment by Ryan Lubke [ 29/May/12 ]

Patch JAR for GlassFish 3.1.2

Comment by Víctor López [ 03/Jul/12 ]

Retrieve session data from a websocket of a previously created session is broken.

Case scenario:

1. Client A connects to Server using HTTP GET request.
2. Server sents login page to Client A from Servlet S1.
3. Client A sent login info to Server using HTTP POST request.
4. Server creates a new HTTPSession and stores some data inside.
5. Server redirects Client A to another web-page on the same server but controlled by Servlet S2.
6. From this web-page Client A tries to connect using websockets.
7. Server Servlet's S2 retrieves session info, but can't retrieve the data which S1 stored.

It works if any other transport protocol than websockets is used.

Comment by oleksiys [ 03/Jul/12 ]

Victor, pls. check
http://java.net/jira/browse/GRIZZLY-1289

Generated at Sat Aug 29 20:13:47 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.