jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mahfouz, Ayman" <ayman.mahf...@citigroup.com>
Subject BasicAuthentication fails with struts app
Date Tue, 18 May 2004 19:33:29 GMT
I have been successful developing a couple of cactus tests for the
HelloWorldServlet that ships with weblogic 8. I also SUCCEEDED in
running the basic authentication example after securing the
ServletRedirectorSecure and using a weblogic admin user that is mapped
to the role "Admin". When I try to run the same example on a
STRUTS-based web application it fails with the given trace:

 

org.apache.cactus.util.ChainedRuntimeException: Failed to get the test
results at [http://localhost:7001/citialert_web/ServletRedirectorSecure]

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t_aroundBody0(DefaultHttpClient.java:92)

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t_aroundBody1$advice(DefaultHttpClient.java:206)

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t(DefaultHttpClient.java)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
WebTest(HttpProtocolHandler.java:159)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test_aroundBody0(HttpProtocolHandler.java:80)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test_aroundBody1$advice(HttpProtocolHandler.java:206)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test(HttpProtocolHandler.java)

            at
org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTes
tCaseCaller.java:144)

            at
org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(Abstract
CactusTestCase.java:215)

            at
org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactus
TestCase.java:133)

            at junit.framework.TestResult$1.protect(TestResult.java:106)

            at
junit.framework.TestResult.runProtected(TestResult.java:124)

            at junit.framework.TestResult.run(TestResult.java:109)

            at junit.framework.TestCase.run(TestCase.java:118)

            at junit.framework.TestSuite.runTest(TestSuite.java:208)

            at junit.framework.TestSuite.run(TestSuite.java:203)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:392)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:276)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:167)

org.apache.cactus.internal.client.ParsingException: Not a valid response
[401 Unauthorized xxx]

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.callG
etResult(DefaultHttpClient.java:211)

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t_aroundBody0(DefaultHttpClient.java:87)

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t_aroundBody1$advice(DefaultHttpClient.java:206)

            at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTes
t(DefaultHttpClient.java)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
WebTest(HttpProtocolHandler.java:159)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test_aroundBody0(HttpProtocolHandler.java:80)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test_aroundBody1$advice(HttpProtocolHandler.java:206)

            at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.run
Test(HttpProtocolHandler.java)

            at
org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTes
tCaseCaller.java:144)

            at
org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(Abstract
CactusTestCase.java:215)

            at
org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactus
TestCase.java:133)

            at junit.framework.TestResult$1.protect(TestResult.java:106)

            at
junit.framework.TestResult.runProtected(TestResult.java:124)

            at junit.framework.TestResult.run(TestResult.java:109)

            at junit.framework.TestCase.run(TestCase.java:118)

            at junit.framework.TestSuite.runTest(TestSuite.java:208)

            at junit.framework.TestSuite.run(TestSuite.java:203)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:392)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:276)

            at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:167)

 

 

I debugged a little bit and it seems that the resultConnection in the
DefaultHttpClient is returning a responseCode = -1.

Please help. 

A fragment of web.xml is below

<security-constraint>

    <web-resource-collection>

      <web-resource-name>SecurityRestriction</web-resource-name>

      <description>Protect the Cactus redirector servlet.</description>

      <url-pattern>/ServletRedirectorSecure</url-pattern>

      <http-method>GET</http-method>

      <http-method>POST</http-method>

    </web-resource-collection>

    <auth-constraint>

      <description>Authorized Users Group</description>

      <role-name>Admin</role-name>

    </auth-constraint>

    <user-data-constraint>

      <transport-guarantee>NONE</transport-guarantee>

    </user-data-constraint>

  </security-constraint>

 

  <login-config>

    <auth-method>BASIC</auth-method>

    <realm-name>myrealm</realm-name>    

  </login-config> 

  <security-role>

    <description>The admin role</description>

    <role-name>Admin</role-name>

  </security-role>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message