Reputation:
Ther is class that extends HttpServlet and trying to access variables set in different class
The following line of code in the class that extends HttpServlet is throwing a NullPOinterException:
SomeObject x = getServletContext().getAttribute("x");
Ideas?
Upvotes: 0
Views: 1911
Reputation: 5315
Probably, you have overridden the init(ServletConfig cfg) method in your Servlet class and did not call the super.init(cfg) to do the standard setup stuff, resulting in an empty context.
Upvotes: 1