Hi Eric, I've noticed that you have not specified any webapp context in your URL, which means you are using the ROOT webapp, right?
WRT to the exception, Cactus states it has received a 302 error code from the server, which means that the URL you have defined in cactus.contextURL=http://eric.in.foo.com:80 is not correct or at least that it does not point *directly* to where the webapp is. It means that someone, in between your request and the webapp is doing a redirect. Cactus is set up *not* to follow redirects as Cactus is there to run unit tests and thus need to be able to catch a redirect in order to test the code that sends that redirect! OTOH your web browser does follow redirects, which is why it is working. So, you need to find out who is doing the redirect: - is it a web server in front of Resin? - is it some Resin redirect/rewriting rules? - is it your application code? -Vincent > -----Original Message----- > From: Eric Mckenna [mailto:[EMAIL PROTECTED]] > Sent: 14 October 2002 18:11 > To: '[EMAIL PROTECTED]' > Subject: Need Help using cactus to run server side DB Queries > > Hello, > The place im contracting for has an api for running sql queries, but the > api > > assumes that the Resin Servlet container is available for pooling, etc. > For my unit tests,some require DB access and running the queries outside > the > servlet container creates long lag times. Some simple queries take > 1-2 minutes. So to fix this I was trying to use cactus run the classes > that > required DB access since these cactus tests would have access to the > intended > sql api. > > I've included the cactus_client.log file. One thing i did notice is that > if > i take the url link from the log file and put it in a browser, the test > runs > (I put some printlines in there and they showed up in the server > stdout.log > file). So i think my problem is probably with configuration. > > any help appreciated. > eric. > > > using: > junit 3.7 > ant 1.5 > cactus 1.4.1 > > Im also running the cactus tests with ant, if that makes any difference. > > ====================================== > cactus.properties: > ====================================== > cactus.contextURL=http://eric.in.foo.com:80 > cactus.servletRedirectorName = ServletRedirector > > > > ====================================== > code sample: > ====================================== > > ... > > public void beginCertConstructor(WebRequest theRequest) > { > // Set up HTTP related parameters > theRequest.setURL("eric.in.foo.com", "", "", null, null); > > } > > //this is what i want run on the server. > public void testCertConstructor() throws Exception > { > ResultSet results = runner.runSql(GET_CERTS_SQL); > results.next(); > Row aRow = results.getRow(); > > MyCertificate myCert = new MyCertificate(); > > try > { > myCert = new MyCertificate(aRow); > } > catch(Exception e) > { > fail("There was an exception with the Constructor: > "+e.getMessage()); > } > } > > ... > > ====================================== > cactus_client.log: > ====================================== > 12:11:01,356 [main] DEBUG test.ServerSideCert - ------------- > Test: testCertConstructor > 12:11:02,538 [main] DEBUG test.ServerSideCert - Exception in > test > org.apache.cactus.util.ChainedRuntimeException: Failed to get the test > results. This is probably due to an error that happened on the server side > when trying to execute the tests. Here is what was returned by the server > : > [<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> > <HTML><HEAD> > <TITLE>302 Found</TITLE> > </HEAD><BODY> > <H1>Found</H1> > The document has moved <A > HREF="http://www.eric.in.foo.com/ServletRedirector?Cactus_TestMethod=tes tC > er > tConstructor&Cactus_URL_ContextPath=&Cactus_URL_Server=eric.in.f oo > .c > om&Cactus_URL_ServletPath=&Cactus_TestClass=com.brainbench.certm ai > le > r.test.ServerSideCert&Cactus_AutomaticSession=true&Cactus_URL_Pr ot > oc > ol=http&Cactus_Service=CALL_TEST">here</A>.<P> > <HR> > <ADDRESS>Apache/1.3.23 Server at www.ericm02 Port 80</ADDRESS> > </BODY></HTML> > ] > at > org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHtt pC > li > ent.java;org/apache/cactus/util/log/LogAspect.aj(1k):120) > at > org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpC li > en > t.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236) > at > org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.ja va > ;o > rg/apache/cactus/util/log/LogAspect.aj(1k):104) > at > org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase .j > av > a:260) > at > org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133) > at > org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195) > 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:131) > at junit.framework.TestSuite.runTest(TestSuite.java:173) > at junit.framework.TestSuite.run(TestSuite.java:168) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe st > Ru > nner.java:325) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT es > tR > unner.java:524) > org.apache.cactus.client.ParsingException: Not a valid response > at > org.apache.cactus.client.WebTestResultParser.readRootElement(WebTestResu lt > Pa > rser.java;org/apache/cactus/util/log/LogAspect.aj(1k):140) > at > org.apache.cactus.client.WebTestResultParser.dispatch29_parse(WebTestRes ul > tP > arser.java;org/apache/cactus/util/log/LogAspect.aj(1k):101) > at > org.apache.cactus.client.WebTestResultParser.around29_parse(WebTestResul tP > ar > ser.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236) > at > org.apache.cactus.client.WebTestResultParser.parse(WebTestResultParser.j av > a; > org/apache/cactus/util/log/LogAspect.aj(1k):96) > at > org.apache.cactus.client.AbstractHttpClient.callGetResult(AbstractHttpCl ie > nt > .java;org/apache/cactus/util/log/LogAspect.aj(1k):230) > at > org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHtt pC > li > ent.java;org/apache/cactus/util/log/LogAspect.aj(1k):114) > at > org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpC li > en > t.java;org/apache/cactus/util/log/LogAspect.aj(1k):1236) > at > org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.ja va > ;o > rg/apache/cactus/util/log/LogAspect.aj(1k):104) > at > org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase .j > av > a:260) > at > org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133) > at > org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195) > 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:131) > at junit.framework.TestSuite.runTest(TestSuite.java:173) > at junit.framework.TestSuite.run(TestSuite.java:168) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTe st > Ru > nner.java:325) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT es > tR > unner.java:524) -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
