Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HttpServletRequest.getSession producing Null Pointer

843840Dec 9 2002 — edited Jan 14 2003
Hi Guys,

I am running an Applet - Servlet system using serialisation for communication using tomcat 3.3 and swing. In one of my servlets, I start a second thread for the purpose of running a batch process, whilst still returning status information to the client.

My problem is that if I try to access HttpServletRequest.getSession() from within the new thread, I get the following exception:

java.lang.NullPointerException
at org.apache.tomcat.core.RequestImpl.getSession(RequestImpl.java:497)
at org.apache.tomcat.facade.HttpServletRequestFacade.getSession(HttpServletRequestFacade.java:382)

It seems that basically you cannot access session information from threads spawned within servlets.

Has anyone had any trouble like this?

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 11 2003
Added on Dec 9 2002
4 comments
569 views