This exception results when client-side Cactus code attempts to talk
to a misconfigured installation of Cactus on the server side. The
reason for the obscure exception is this: Cactus makes two requests
to the server. In the first, the client-side test runner requests that
such-and-such a test be run on the server (an oversimplification,
please see: XXXX). Immediately after the response from the server
the client code makes a second request, this time for the results of
the server-side test. Cactus is supposed to send back a serialized
Object containing the results. Cactus then attempts to deserialize
this Object from the input stream in the response. If
Cactus is installed properly on the server, this process
works transparently. If not (for instance the second
request does not even arrive at a Cactus redirector) then
the response to the second request (which very well may be
a 404 or 500 error) will not contain the object that
client-cactus expects. This leads to the
StreamCorruptedException.
When troubleshooting this error, the most likely prospect
is that the requests from client-Cactus are not even
reaching server-Cactus. This can happen when the
cactus.properties
contains a bad entry. For instance, I
have run into this problem when building several different
testing-applications. I tried to run my tests against
http://localhost/webapp1/ServletRedirector/
when I needed
to be running against
http://localhost/webapp2/ServletRedirector/
. This can
also happen if your web.xml file contains an error, or does not
properly map the URLs contained in cactus.properties to the
Cactus redirectors.
A good way to check whether your requests are reaching a
Cactus redirector is to manually enter in the URLs for all
of the redirectors you use into the navigation bar of your
web-browser. Actually the Cactus redirectors provide a URL just for
that : http://localhost/webapp/ServletRedirector?Cactus_Service=RUN_TEST
(this also works for the other redirectors).
 |
If you call http://localhost/webapp/ServletRedirector
directly, you'll get a 500 error and get a stack trace (in the log or
along with your error page) that says Missing service
name parameter [] in HTTP request. . This is because the
Cactus redirector expects HTTP parameter from the Cactus client side.
|
Another likely error is that your server-side classpath
does not contain a copy of the cactus.jar. (Cactus is
effectively not present on the server.) According to
e-mails on the Cactus user list, the
StreamCorruptedException
could also result when you are
using the wrong version of the servlet.jar in some area
(any version prior to 2.2, or using servlet.jar 2.2 with a
Cactus-2.3 installation).