Problem about RequestDispatcher causing NullPointerException in Cactus

Dahai Guo <[email protected]> Fri, 5 Feb 2010 05:42:06 -0800 (PST)
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
Hi,

I am new to Cactus and trying to run an in-container test to a servlet. In this servlet, the request is dispatched to a jsp:

1. RequestDispatcher view = request.getRequestDispatcher("display.jsp");
2. view.forward(request, response);

I was using the following main method to launch the Jetty webserver:

public class TestAdminSuite {
	public static Test suite(){
		System.setProperty("cactus.contextURL", "http://localhost:8080");
		TestSuite suite = new TestSuite("all test with Jetty");
		suite.addTestSuite(TestAdminServlet.class);
		return new Jetty5xTestSetup(suite);
	}
}

Then "view.forward(request,response);" would cause NullPointerException. I think that the problem occurs when the Jetty web server cannot locate the jsp file. I really cannot figure out how to let Jetty know where the jsp file is.

Any hint will be greatly appreciated!

Dahai