Missing HTTP Session

From: Sharib Anis <>
Date: Fri, 7 Jan 2005 15:30:57 +0800

Hello All,
I have set up a jax-rpc web service which works fine normally. The service
runs on JWSDP1.3, using the bundled Tomcat. However I'm trying to implement
sessions and see some problems. The problems occur mainly from getting
information from the HttpServletRequest object. I get this object, per
request, using the standard way defined by Sun, i.e. getting the
MessageContext and then the HttpServletRequest.
Now while creating a new session, I call HttpServletRequest.getSession() and
everything is fine. However, when the client tries to access a service
method, then the call fails because the HttpServletRequest.getSession(false)
then returns null. And even more strangely, the session is found when the
client makes subsquent method calls.
This happens when I do some load testing and try connect many clients to the
service. If I put a delay after each session creation, then this problem
goes away. Is it because the container needs time to create sessions? But if
that is the case, should it not just block the getSession() method and
return a proper session?
Another issue I see is that HttpServletRequest.isUserInRole() fails
intemittently for no apparent reason while the service is in operation.
Sorry for being a bit long winded and dense, but such is the issue. Hope
somebody can help.

Thanks and Regards,
Sharib Anis