HttpServletRequest.getSession producing Null Pointer
843840Dec 9 2002 — edited Jan 14 2003Hi 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.