Filter throwing java.lang.NullPointerException

Hello,

The Filter I'm trying to write is throwing a java.lang.NullPointerException error.

Following is the code from doFilter:

HttpServletRequest request = (HttpServletRequest) servletRequest;

HttpSession session = request.getSession(false);

ServletContext servletContext = session.getServletContext();

The 3rd line is what is throwing the error as session is null.

Thanks.

[456 byte] By [HEIDEBRINKa] at [2007-11-26 14:27:00]
# 1
there isn't a session coming back from the HttpRequest
georgemca at 2007-7-8 2:20:28 > top of Java-index,Java Essentials,Java Programming...
# 2
It is null because in the previous line you have requested the session but told the requrest not to create a session if one does not exist. So, a session does not exist.
sabre150a at 2007-7-8 2:20:28 > top of Java-index,Java Essentials,Java Programming...