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.
この例外は クライアント側の Cactus のコードがサーバー側で設定に不備
があるままインストールされた Cactus とやり取りしようとした結果です。
この良く分からない例外の理由はこうです:Cactus は二種類のリクエスト
をサーバーに送ります。最初は クライアント側で実行中のテストはつまり
いわいる test をサーバー上で実行するように要求します。(単純化しす
ぎですね。XXXX の部分を見てください)サーバーからレスポンスが返って
きてすぐにクライアント側から第二のリクエストが、この時はサーバー側
のテストの結果の為に発せられます。Cactus では シリアライズされたオ
ブジェクトにテストの結果を入れて返すようになっています。Cactus は
それからレスポンスの入力ストリームからこのオブジェクトをシリアライ
スより復元しようとします。もし Cactus が正常にサーバーにインストー
ルされているなら、このプロセスは素直に上手く行きます。もしそうで
ないなら(例えば2番目のリクエストが Cactus のリダイレクタにすら届
いていないとか。)2番目のリクエストへのレスポンス(多分に 404 か
500 のエラーでしょう。)はクライアント側の Cactus が期待したオブジ
ェクトを含んでいません。こうして 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.
このエラートラブル対策時に、最もそれらしく見込みのあるのはクライアント
側の Cactus からのリクエストがサーバー側に届いていない事でしょう。
これは cactus.properties が間違った設定を含んでいる時に
発生します。例えば幾つかの異なったテスト用のアプリケーションを構築し
ている時にこの問題にはまってしまいました。正確には
http://localhost/webapp2/ServletRedirector/ に対して実行
していなければならないのに、http://localhost/webapp1/ServletRedirector/
に対してテストを実行していたのです。この件はまた、web.xml ファイルに
誤りが含まれている時や cactus.properties に含まれる Cactus のリダイ
レクタへの URL が正しくマップされていない場合にも発生する事があります。
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).
リクエストが Cactus のリダイレクタへ届いているかどうかを確認する
為の良い方法は Web ブラウザのナビゲーションバーに利用する全ての
リダイレクタの URL を打ち込んで見ることです。実際に Cactus の
リダイレクタは単に次のような URL で呼び出すようになっています:
http://localhost/webapp/ServletRedirector?Cactus_Service=RUN_TEST
(これは他のリダイレクタも同様に動きます。)
 |
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.
|
 |
もし http://localhost/webapp/ServletRedirector を直接呼び
出した場合には、500 番のエラーと以下のようなスタックトレース(ログの中
にか、エラーページにか)が得られるでしょう。
Missing service name parameter [] in HTTP request..
これは Cactus のリダイレクタは Cactus クライアントからの HTTP パラメータ
を受け取るようになっているからです。
|
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).
他のよくあるエラーとしてはサーバー側のクラスパスが cactus.jar を
含んでいないことです。(サーバー上で Cactus が有効な状態になって
いない。)Cactus の ユーザーリストの e-mail によれば
StreamCorruptedException は servlet.jar の間違った
バージョンのものを使ったばあいにも発生するそうです。