0 Replies Latest reply on Jan 20, 2004 11:55 AM by thelemmings

    Keeping the same context between different war files

    thelemmings Newbie

      Hi,
      I'm trying to go from a servlet, stored in a war (servlets.war, context-root in /servlets) to a jsp file stored in another war (jsp.war, context root in /jsp). My code is shown below, but it seems like there are two differents contexts for each of these war files, so the redirection can not happen.

      RequestDispatcher disp =
      this.getServletContext().getRequestDispatcher("/../jsp/login.jsp");
      disp.forward(request, response);

      I get a NullPointerException:

      [Engine] StandardWrapperValve[LoginServlet]: Servlet.service() for servlet LoginServlet threw exception: java.lang.NullPointerException
      the log shows errors from org.apache.catalina.core or
      org.apache.tomcat so I presume I'm using Tomcat, not Jetty

      I tried assigning both wars to the / context root in application.xml, and changing the files' <jsp-file> and <url-pattern> by prefixing the /jsp/ and /servlets/ respectively in order to preserve the links, but it still doesn't work.

      Is it possible to share a common context between my war files? or is that really the problem? how come RequestDispatcher.forward() gives me a null?

      Thanks for any help :)
      Luc