Hello all:

I'm using Cactus to test a servlet which includes a call to 
request.getRequestDispatcher("pageName").forward(request, response).  In production 
the servlet works correctly.  However my Cactus test fails with a 
NullPointerException, leading me to believe I'm failing to set up some part of the 
Cactus environment which Cactus expects.

In testing I've noticed that this call succeeds inside a testXXX method:

    assertNotNull(config.getServletContext().getRequestDispatcher("/foo.jsp"));

While this call fails with NPE inside an otherwise identical testXXX method:

    assertNotNull(request.getRequestDispatcher("foo.jsp"));

The two testXXX methods do include calls to servlet.init(config).

Here's what looks like the relevant portion of the Cactus stack trace:

null

java.lang.NullPointerException
at 
org.apache.cactus.server.AbstractHttpServletRequestWrapper.catPath(AbstractHttpServletRequestWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):399)
at 
org.apache.cactus.server.AbstractHttpServletRequestWrapper.dispatch43_getRequestDispatcher(AbstractHttpServletRequestWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):369)
at 
org.apache.cactus.server.AbstractHttpServletRequestWrapper.around43_getRequestDispatcher(AbstractHttpServletRequestWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):1218)
at 
org.apache.cactus.server.AbstractHttpServletRequestWrapper.getRequestDispatcher(AbstractHttpServletRequestWrapper.java;org/apache/cactus/util/log/LogAspect.aj(1k):343)

Is there some step I need to take so that request.getRequestDispatcher() will suceed 
inside testXXX?

Thanks!

--Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to