Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange servlet exception

0 views
Skip to first unread message

CarloC

unread,
Feb 1, 2008, 10:35:41 AM2/1/08
to
Hi,
inside my generic servlet I get this error when I call this method:
'session.getAttribute' command (line 36):

java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:336)
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:
1024)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:
110)
at workcity.servlet.GenericServlet.checkToken(GenericServlet.java:36)

This is the java code:

HttpSession session = req.getSession();
ArcUtente vo = (ArcUtente) session.getAttribute(token);

req is a HttpServletRequest object !=null and
token is a String object != null.

You can help my?
Carlo

Daniel Pitts

unread,
Feb 1, 2008, 3:10:41 PM2/1/08
to

Looking at the JavaDoc for Hastable:
* @throws NullPointerException if the specified key is null
It very well could be token really is null.
Just to verify, try this:

HttpSession session = req.getSession();
if (token == null) { throw new NullPointerException("Token really IS
null!") };

0 new messages