You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by bi...@firstunion.com on 2001/12/04 20:25:32 UTC

Need help on Session's null pointer exception

I run a servlet on Tomcat3.3 and got the following error:

java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:380)
        at org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
Source)
        at =
org.apache.tomcat.facade.HttpSessionFacade.setAttribute(Unknown Sourc
e)
        at org.apache.tomcat.facade.HttpSessionFacade.putValue(Unknown =
Source)
        at =
com.fub.its.servlet.SecuredServlet.setCurrentEmployee(SecuredServlet.
java:162)
        at =
com.fub.its.controller.DepartmentController.checkForSwitchToDepartmen
t(DepartmentController.java:47)
        at =
com.fub.its.controller.DepartmentController.doGet(DepartmentControlle
r.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at =
com.fub.its.servlet.ApplicationServlet.service(ApplicationServlet.jav
a:160)
        at =
com.fub.its.servlet.SecuredServlet.service(SecuredServlet.java:129)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java)
        at org.apache.tomcat.facade.ServletHandler.doService(Unknown =
Source)
        at org.apache.tomcat.core.Handler.invoke(Unknown Source)
        at org.apache.tomcat.core.Handler.service(Unknown Source)
        at org.apache.tomcat.facade.ServletHandler.service(Unknown =
Source)
        at org.apache.tomcat.core.ContextManager.internalService(Unknown =
Source)

        at org.apache.tomcat.core.ContextManager.service(Unknown Source)
        at =
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(
Unknown Source)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown =
Source)
        at =
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
 Source)
        at java.lang.Thread.run(Thread.java:484)
------End of System Error-------------------------------
--------------------------------------------------------


Can anyone kindly tell me what is wrong with my setting?  I changed the
expiration time for session in server.xml
and I am sure the SessionIdGenerator is set too.


Bill


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Need help on Session's null pointer exception

Posted by Denis Balazuc <de...@trader.com>.
Hi

You are simply trying to set a null value in a session, which is
forbidden.....something like session.setAttribute("HelloWorld", null);

I'm not sure this behaviour is specified in JSP specs though....
it's more because a Hashtable is used as the Map to store key=value session
attributes within Tomcat.


> I run a servlet on Tomcat3.3 and got the following error:
>
> java.lang.NullPointerException
>         at java.util.Hashtable.put(Hashtable.java:380)
>         at org.apache.tomcat.core.ServerSession.setAttribute(Unknown =
> Source)
> Can anyone kindly tell me what is wrong with my setting?  I changed the
> expiration time for session in server.xml
> and I am sure the SessionIdGenerator is set too.
>
>
> Bill
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>