Hi Curt,

I'm not sure why you're getting this error. However, there are a lot of
limitations in the HttpURLConnection class from JDK 1.3, especially to
retrieve error codes. So by looking at the source, I found that adding a
trailing "/" seemed to work. However, it is not the correct way of doign it
(actually the trailing "/" has even been removed in the latest versions of
cactus in CVS as we are now passing cactus internal parameters in the URL -
so it cannot end with a "/"). The solution we have found is to use Commons
HttpClient to open the http connection, instead of HttpURLConnection. This
is a work in progress and it will be in Cactus 1.3.

In the meantime, forget about this test (comment it out for example) which
may not work on all jdks (for example if you have jdk 1.3.1 it seems there
is another way of doing it with error streams, ...).

Thanks
-Vincent

----- Original Message -----
From: "Curt Beckmeier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 24, 2001 6:12 PM
Subject: testStatusCode


> I'm having trouble running the tests_tomcat_40 suite in the sample
directory.
> testStatusCode tests fails as follows.  Thanks, Curt
>
>     [junit] Testcase: testStatusCode took 0.031 sec
>     [junit]     Caused an ERROR
>     [junit] Server returned HTTP response code: 401 for URL:
> http://localhost:8180/test/ServletRedirector/
>     [junit] java.io.IOException: Server returned HTTP response code: 401
for
> URL: http://localhost:8180/test/ServletRedirector/
>     [junit]     at
>
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection
.java:693)
>     [junit]     at
>
org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoReadHt
tpURLConnection.java:127)
>     [junit]     at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:1
36)
>     [junit]     at
>
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422)
>     [junit]     at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>     [junit]     at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
> [junit]     at junit.framework.TestResult$1.protect(TestResult.java:106)
>     [junit]     at
> junit.framework.TestResult.runProtected(TestResult.java:124)
>     [junit]     at junit.framework.TestResult.run(TestResult.java:109)
>     [junit]     at junit.framework.TestCase.run(TestCase.java:131)
>     [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:173)
>     [junit]     at junit.framework.TestSuite.run(TestSuite.java:168)
>     [junit]     at junit.framework.TestSuite.runTest(TestSuite.java:173)
>     [junit]     at junit.framework.TestSuite.run(TestSuite.java:168)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRu
nner.java:231)
>     [junit]     at
>
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestR
unner.java:409)
>     [junit]
>
> stop_tomcat_40:
>      [java] Stopping service Tomcat-Standalone
>      [java] HttpConnector[8180] Stopping background thread
>      [java] StandardHost[localhost]: Removing web application at context
path
> /test
> [runservertests] Server stopped !
>
> BUILD FAILED
>
> /home/curt/jakarta-cactus-23-1.2/sample/build/build.xml:376: Test
> org.apache.cactus.TestAll failed
>
> Total time: 22 seconds
>
>

Reply via email to