tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Brogden <wbrog...@bga.com>
Subject Re: getServletContext return nullpointer-exception
Date Fri, 08 Dec 2000 01:15:47 GMT


andreas ebbert wrote:
> 
> Hi,
> I am trying to get a servlets context
> with getServletContext() but all I get
> is a NullPointerException. Can anybody
> help me?
> 
> greetings,
> Andreas

The usual reason for this is a failure to call super.init()
in your servlet init method. Assuming your init is:

  public void init( ServletConfig config ){
     super.init( config ) ; // Essential!!
    ....
  }
-- 
WBB - wbrogden@lanw.com
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP 
ISBN 0-7821-2809-2

Mime
View raw message