tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: servletcontext weird nullpointerexception
Date Wed, 02 Jul 2003 10:59:16 GMT
In your Servlet's init(...) make sure your call super.init(...)

-Tim

Mathias af Jochnick wrote:
> Hello all,
> 
> I have a Servlet that I've setup in the /conf/web-xml file, i.e. not in a
> web-app.
> 
> It works fine, except for that when I in the doGet() method call
> getServletContext(), tomcat throws a nullpointerexception!
> 
> java.lang.NullPointerException
> 	at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
> 
> Can anyone shed a light on why this is happening?
> 
> My workaround is a reference to the ServletContext in the class, that I
> assign in the init()-method, because I can get the ServletContext from the
> ServletConfig init-parameter.
> 
> /Mathias
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message