You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christian Ribeaud <ch...@predict.ch> on 2001/10/08 15:35:32 UTC

[winNT, tomcat 3.2.3, jdk1.3.0_01]this.getServletContext();

Hi,

I have been trying to find out why I suddenly get a NullPointException in the service() function with the following lines of code:
  ServletContext context = this.getServletContext(); (and any varation)
and why this:
  ServletContext context = config.getServletContext();
works fine in the init() function. Do I have forgotten something? Any help would be gratefully appreciated. Have a nice day,

christian


RE: [winNT, tomcat 3.2.3, jdk1.3.0_01]this.getServletContext();

Posted by Christian Ribeaud <ch...@predict.ch>.
Hi,

After having heavily worked on this problem, I found out the crap:
If you overwrite the init() function in your servlet, you nevertheless
have to call the super.init(config). Thanks for the help.
Cheers,

christian

> Hi,
>     I think the config object is available in the 
> init(ServletConfig config) method of a servlet.
> 
> Namaskar
> 
> P.G.Jai Ganesh


Re: [winNT, tomcat 3.2.3, jdk1.3.0_01]this.getServletContext();

Posted by jai ganesh <ja...@timesgroup.com>.
Hi,
    I think the config object is available in the init(ServletConfig config) method of a servlet.

Namaskar

P.G.Jai Ganesh

Christian Ribeaud wrote:

> Hi,
>
> I have been trying to find out why I suddenly get a NullPointException in the service() function with the following lines of code:
>   ServletContext context = this.getServletContext(); (and any varation)
> and why this:
>   ServletContext context = config.getServletContext();
> works fine in the init() function. Do I have forgotten something? Any help would be gratefully appreciated. Have a nice day,
>
> christian