Looking at the source (available from
http://jakarta.apache.org/builds/jakarta-tomcat/release/) it looks like the
only way this would happen is if it doesn't have the ServletConfig passed
into its init() method.
Are you intercepting the call to init() in your servlet? If so, are you
making sure to call the superclass' init() method?
-- Bill K.
> -----Original Message-----
> From: Stefanos Karasavvidis [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 10, 2001 7:46 AM
> To: [EMAIL PROTECTED]
> Subject: getServletContext() throws NullPoinetException
>
>
> I've just installed tomcat 3.2.2 and have the following problem.
>
> I want to call getServletContext() from a servlets service method but
> get the folowing exception
> *Internal Servlet Error:*
>
> java.lang.NullPointerException
> at
> javax.servlet.GenericServlet.getServletContext(GenericServlet.
> java:205)
> at TestServlet.service(TestServlet.java:32)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> .java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:797)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
> org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pro
> cessConnection(Ajp12ConnectionHandler.java:166)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> t.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> ol.java:501)
> at java.lang.Thread.run(Thread.java:484)
>
>
> Moreover the getServletConfig() returns null which is
> probably the main
> reason for this problem
>
> Any ideas??
>
> Stefanos
>
>