You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Daniel Rabe <dr...@opentext.com> on 2003/12/13 03:37:47 UTC

Accessing the servlet that's already running?

There's something that I just don't get, and it's causing my brain to hurt.
;-) I hope someone can set me straight.

I'm using Tomcat 5.0, Struts 1.1, and Cactus 1.5 on Windows XP.

When I run the <cactus> task from ant, it starts up Tomcat, which unpacks my
cactified war, and starts my servlet, right? I *think* what I want to do is
code my test (a subclass of ServletTestCase) so that I specify the request
in my beginXX, and in endXX I want to sanity-check the output. What do I do
in testXX? The examples I've seen show creation and initialization of a
Servlet in textXX... but... but... my servlet's already instantiated and
running, right? It seems like my testXX should be able to get a reference to
that already-running servlet and just call doService() on it; however, I
can't seem to get a reference to the servlet. What am I missing here?

I know that my servlet has problems when I try to destroy it and
re-instantiate it (because of statics in some legacy code we're using). Is
this likely to cause problems anywhere other than in cactus-type testing?

Thanks in advance,
--DanR