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?
-Richard --- Oliver Meyn <[EMAIL PROTECTED]> wrote: > Hi, > > I've put an object into the ServletContext with an > init servlet started > on load via web.xml. Accessing it with my main > Action works fine, but > when I try to use another servlet (extend > HttpServlet) to > getServletContext() it throws a null pointer > exception (doesn't just > return null - goes straight to the exception). From > the javadoc on > ServletContext I'm led to believe that all servlets > in the app share the > same ServletContext, so I'm confused. I'm > attempting this lookup in the > constructor of the servlet - does it have to happen > in a doGet or such? > Any ideas? > > Also, is there some way of accessing the > ServletContext without being a > Servlet? > > Thanks very much, > Oliver > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]