-
Bug
-
Resolution: Done
-
Major
-
2.0.0.Final
-
None
-
None
It seems the following code is legal (alhough it's not very clear in the Servlet spec):
// This servlet is part of CDI-enabled webapp1 @WebServlet("/info1") public class InfoServlet1 extends HttpServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // CDI-enabled webapp2 contains InfoServlet2 mapped to /info2 req.getServletContext().getContext("/webapp2").getRequestDispatcher("/info2").include(req, resp); } }
The problem is the WeldListener in webapp2 cleans up bound request context (ThreadLocal bean store) after the InfoServlet2 processing is finished. Afterwards the request context deactivation in webapp1 results in NPE.