tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: getServletContext() returns null
Date Sat, 01 Jul 2000 04:48:44 GMT
Harry Chen wrote:

> Hi. I got my servlets start running just fine. I can even do servlet
> renaming. But for some reason, everytime i try to call getServletContext()
> or getServletConfig() in either doGet() or doPost() method, it always
> return NullPointerException.

99.9% of the time that means you overrode the init(ServletConfig config)
method without calling


in your init() method.  The best way to avoid this error is to use the init()
method without arguments for your own initialization.

> Any idea?  thanks.

Craig McClanahan

View raw message