You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Sisk <js...@yahoo.com> on 2001/05/19 15:21:56 UTC
CookieServlet giving a NullPointerException
Hi,
This is the start of the stacktrace I get when I try the Tomcat (v
4.0-b-5)CookieExample servlet. Worked fine on Tomcat 3.2 win98/win2k, broke
when I upgraded to 4.0. Has anyone else seen/fixed this before I start
digging?
A Servlet Exception Has Occurred
java.lang.NullPointerException
at CookieExample.doGet(CookieExample.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
Regards
John Sisk
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Re: CookieServlet giving a NullPointerException
Posted by Bo Xu <bo...@cybershop.ca>.
John Sisk wrote:
> Hi,
>
> This is the start of the stacktrace I get when I try the Tomcat (v
> 4.0-b-5)CookieExample servlet. Worked fine on Tomcat 3.2 win98/win2k, broke
> when I upgraded to 4.0. Has anyone else seen/fixed this before I start
> digging?
>
> A Servlet Exception Has Occurred
> java.lang.NullPointerException
> at CookieExample.doGet(CookieExample.java:53)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>
> Regards
> John Sisk
Hi :-) I am not sure, in CookieExample.java from Tc4.0-b5:
...
Cookie[] cookies = request.getCookies(); //line52
if (cookies.length > 0) { //line53
...
so I think the reason is:
with some reason, "cookies" is null, so you got a NullPointerException.
Bo
may.19, 2001