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 Ke...@spektra.co.uk on 2001/12/14 19:29:24 UTC

500 error after accessing WebRequest object

Wondering if anyone can help me...
I set up a cactus test (testInit) which ran succesfully to conclusion with 
empty method bodies on beginInit, testInit endInit.
I then tried setting a header value in beginInit, using the WebRequest 
object. The header was set correctly (I checked this by reading the 
headers back from the WebRequest object, immediately after setting) but 
the test then threw the following error:

test.uk.co.spektra.ofs.runtime.TestCactusOrigoHTTPInput constructor
.beginInit
E
Time: 0.862
There was 1 error:
1) testInit(test.uk.co.spektra.ofs.runtime.TestCactusOrigoHTTPInput)
java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/ServletRedirector/
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:564)
        at 
org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoReadHttpURLConnection.java:127)
        at 
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java:136)
        at 
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:422)
        at 
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
        at 
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
        at 
test.uk.co.spektra.ofs.runtime.LocalTestPackage.main(LocalTestPackage.java:27)
 
FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1
 
This error appears to get thrown when I start trying to access the 
WebRequest method.
Having looked at the archives, I see references to 500 errors, but not 
exactly the same situation.
Any ideas?
Thanks
Ken

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: 500 error after accessing WebRequest object

Posted by Vincent Massol <vm...@octo.com>.
Ken,

I don't know what's wrong with what you're doing - it seems fine to me
(unless you're modifying a "vital" header which cause the server to
throw a 500 exception).

There is one test in the Cactus test suite that does this : it is as
follows :

public void beginSendHeader(WebRequest theRequest)
{
    theRequest.addHeader("testheader", "this is a header test");
}

public void testSendHeader()
{
    assertEquals("this is a header test",
       request.getHeader("testheader"));
}

-Vincent

> -----Original Message-----
> From: KenRussell@spektra.co.uk [mailto:KenRussell@spektra.co.uk]
> Sent: 14 December 2001 18:29
> To: cactus-user@jakarta.apache.org
> Subject: 500 error after accessing WebRequest object
> 
> Wondering if anyone can help me...
> I set up a cactus test (testInit) which ran succesfully to conclusion
with
> empty method bodies on beginInit, testInit endInit.
> I then tried setting a header value in beginInit, using the WebRequest
> object. The header was set correctly (I checked this by reading the
> headers back from the WebRequest object, immediately after setting)
but
> the test then threw the following error:
> 
> test.uk.co.spektra.ofs.runtime.TestCactusOrigoHTTPInput constructor
> .beginInit
> E
> Time: 0.862
> There was 1 error:
> 1) testInit(test.uk.co.spektra.ofs.runtime.TestCactusOrigoHTTPInput)
> java.io.IOException: Server returned HTTP response code: 500 for URL:
> http://localhost:8080/ServletRedirector/
>         at
>
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnec
ti
> on.java:564)
>         at
>
org.apache.cactus.client.AutoReadHttpURLConnection.getInputStream(AutoRe
ad
> HttpURLConnection.java:127)
>         at
>
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.ja
va
> :136)
>         at
>
org.apache.cactus.AbstractTestCase.runGenericTest(AbstractTestCase.java:
42
> 2)
>         at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>         at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
>         at
>
test.uk.co.spektra.ofs.runtime.LocalTestPackage.main(LocalTestPackage.ja
va
> :27)
> 
> FAILURES!!!
> Tests run: 1,  Failures: 0,  Errors: 1
> 
> This error appears to get thrown when I start trying to access the
> WebRequest method.
> Having looked at the archives, I see references to 500 errors, but not
> exactly the same situation.
> Any ideas?
> Thanks
> Ken
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>