jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Phillips <gwai...@earthlink.net>
Subject Newbie question re forwarding
Date Thu, 29 May 2003 20:07:38 GMT
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

Mime
View raw message