struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claire Wall" <claire.w...@kurtosys.com>
Subject Re: getServletContext() throws null pointer
Date Wed, 10 Dec 2003 17:50:50 GMT
as i understand it, in order to retrieve the servlet context, you need to
use the ServletConfig to retrieve it like so:

config.getServletContext()


this sounds similar to a problem that i had where i was trying to log
something from a servlet, just used the log() method and it through an
exception pretty much like the one you are experiencing. however, by putting
config.getServletContext().log() it threw no exceptions...


----- Original Message -----
From: "Oliver Meyn" <lists@mineallmeyn.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Wednesday, December 10, 2003 5:41 PM
Subject: Re: getServletContext() throws null pointer


> On Wed, 2003-12-10 at 12:18, Richard Yee wrote:
> > Oliver,
> > Are you overriding init(ServletConfig config) in your
> > init servlet? If so, did you call super.init(config)
> > before you tried accessing the ServletContext?
> >
> I'm not overriding init(config) but I am overriding init().  I hadn't
> been calling super.init() but gave that a shot and no change.  I am able
> to access the ServletContext (and the init-ed object) from both my
> controlling Action and from a jsp - just not from another servlet.  I
> must be missing something simple yet fundamental...
>
> Thanks,
> Oliver
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



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


Mime
View raw message