Check your cactus.properties file and make sure you have the servlet redirect
to matches this: http://localhost:8080/javaWebAppSec/ServletRedirector
If that is not the issue, make sure you have the ear file deployed correctly in
your application server.
I saw this problem once because the cactus test was running against the wrong
ear file deployed.
"Cody, John T" <[EMAIL PROTECTED]> wrote: I'm getting a ChainedRuntimeException
when I try to run my tests. My application uses forms based authentication,
and I know that the authentication piece is working and the error message says
that it can't connect to the secured redirector. Below is all the code that I
can think of that might be relevant. Any help you can provide would be great.
Thanks
john
Below is my ServletTestCase
package controller;
import java.util.ArrayList;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
import org.apache.cactus.client.authentication.FormAuthentication;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class SesServletTestStuActions extends ServletTestCase {
private int testCtr = 0;
private static ArrayList actions = new ArrayList();
public void begin(WebRequest request) throws Exception {
actions.add("index");
actions.add("listClasses");
actions.add("courseDetail");
actions.add("listCourses");
actions.add("logout");
// This is the only action a student can't do.
actions.add("listEntities");
// We only need to authenticate the user once, for each ServletTestCase
request.setAuthentication(new FormAuthentication("[EMAIL PROTECTED] ",
"testStu"));
request.addParameter("action", actions.get(testCtr));
}
public void end(WebRequest request) throws Exception {
actions = null;
testCtr++;
}
// Testing actions that a student can do
@Test
public void testUserHasPermission1() throws Exception {
SesServlet sesServlet = new SesServlet();
assertTrue("The user can NOT perform this action",
sesServlet.userHasPermission(request));
}
}
Part of my web.xml where I'm defining the servlet mappings for the redirectors:
ServletRedirector
org.apache.cactus.server.ServletTestRedirector
ServletRedirector
/ServletRedirector
ServletRedirectorSecure
org.apache.cactus.server.ServletTestRedirector
ServletRedirectorSecure
/ServletRedirectorSecure
ServletTestRunner
org.apache.cactus.server.runner.ServletTestRunner
ServletTestRunner
/ServletTestRunner
Results/Stacktrac below:
â
â
â
org.apache.cactus.util.ChainedRuntimeException: Failed to connect to the
secured redirector: http://localhost:8080/javaWebAppSec/ServletRedirector
at
org.apache.cactus.client.authentication.FormAuthentication.getSecureSessionIdCookie(FormAuthentication.java:315)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate_aroundBody10(FormAuthentication.java:354)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate_aroundBody11$advice(FormAuthentication.java:217)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate(FormAuthentication.java)
at
org.apache.cactus.client.authentication.FormAuthentication.configure_aroundBody0(FormAuthentication.java:105)
at
org.apache.cactus.client.authentication.FormAuthentication.configure_aroundBody1$advice(FormAuthentication.java:217)
at
org.apache.cactus.client.authentication.FormAuthentication.configure(FormAuthentication.java)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect_aroundBody0(HttpClientConnectionHelper.java:103)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect_aroundBody1$advice(HttpClientConnectionHelper.java:288)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect(HttpClientConnectionHelper.java)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.callRunTest(DefaultHttpClient.java:162)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody0(DefaultHttpClient.java:80)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody1$advice(DefaultHttpClient.java:288)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest(DefaultHttpClient.java)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runWebTest(HttpProtocolHandler.java:159)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest_aroundBody0(HttpProtocolHandler.java:80)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest_aroundBody1$advice(HttpProtocolHandler.java:288)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest(HttpProtocolHandler.java)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTestCaseCaller.java:144)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(AbstractCactusTestCase.java:215)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactusTestCase.java:133)
at
org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java:308)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(ServletTestRunner.java:186)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advice(ServletTestRunner.java:217)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at application.RequestLogger.doFilter(RequestLogger.java:60)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.servi
ce(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:613)
java.lang.Exception: Received a status code [500] and was expecting less than
400
at
org.apache.cactus.client.authentication.FormAuthentication.checkPreAuthResponse(FormAuthentication.java:270)
at
org.apache.cactus.client.authentication.FormAuthentication.getSecureSessionIdCookie(FormAuthentication.java:311)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate_aroundBody10(FormAuthentication.java:354)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate_aroundBody11$advice(FormAuthentication.java:217)
at
org.apache.cactus.client.authentication.FormAuthentication.authenticate(FormAuthentication.java)
at
org.apache.cactus.client.authentication.FormAuthentication.configure_aroundBody0(FormAuthentication.java:105)
at
org.apache.cactus.client.authentication.FormAuthentication.configure_aroundBody1$advice(FormAuthentication.java:217)
at
org.apache.cactus.client.authentication.FormAuthentication.configure(FormAuthentication.java)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect_aroundBody0(HttpClientConnectionHelper.java:103)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect_aroundBody1$advice(HttpClientConnectionHelper.java:288)
at
org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper.connect(HttpClientConnectionHelper.java)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.callRunTest(DefaultHttpClient.java:162)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody0(DefaultHttpClient.java:80)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest_aroundBody1$advice(DefaultHttpClient.java:288)
at
org.apache.cactus.internal.client.connector.http.DefaultHttpClient.doTest(DefaultHttpClient.java)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runWebTest(HttpProtocolHandler.java:159)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest_aroundBody0(HttpProtocolHandler.java:80)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest_aroundBody1$advice(HttpProtocolHandler.java:288)
at
org.apache.cactus.internal.client.connector.http.HttpProtocolHandler.runTest(HttpProtocolHandler.java)
at
org.apache.cactus.internal.client.ClientTestCaseCaller.runTest(ClientTestCaseCaller.java:144)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBareClient(AbstractCactusTestCase.java:215)
at
org.apache.cactus.internal.AbstractCactusTestCase.runBare(AbstractCactusTestCase.java:133)
at
org.apache.cactus.server.runner.ServletTestRunner.run(ServletTestRunner.java:308)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody0(ServletTestRunner.java:186)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet_aroundBody1$advice(ServletTestRunner.java:217)
at
org.apache.cactus.server.runner.ServletTestRunner.doGet(ServletTestRunner.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at application.RequestLogger.doFilter(RequestLogger.java:60)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
terChain.java:188)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:613)
---------------------------------
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.