Constructor is the answer to your problem. There are no guarantee that the servlet that set the data will be loaded before the servlet that accessing it.
Danny Trieu Internet Business Group Downey Savings and Loan Association, F.A. [EMAIL PROTECTED] (949) 509-4564 "The beginning of knowledge is the discovery of something we do not understand." - Frank Herbert (1920-1986) "The essence of knowledge is, having it, to apply it; not having it, to confess your ignorance." - Confucius (551-479 BC) -----Original Message----- From: Oliver Meyn [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 9:08 AM To: [EMAIL PROTECTED] Subject: getServletContext() throws null pointer 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] This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]