2248 INFO [main] (HttpTestBase.java:177) - Posting j_security_check Form
2251 DEBUG [main] (HttpTestBase.java:114) - Connecting to http://localhost:8080/emi/security/j_security_check
Sending:: User-Agent: httpunit/1.4
Sending:: Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Accept-Encoding: gzip
Sending:: Referer: http://localhost:8080/emi/security/login.jsp;jsessionid=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Content-Type: application/x-www-form-urlencoded
Header:: HTTP/1.1 302 Moved Temporarily
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Content-Language: en-US
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
Header:: Location: http://localhost:8080/emi/index.jsp
Sending:: User-Agent: httpunit/1.4
Sending:: Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Accept-Encoding: gzip
Header:: HTTP/1.1 200 OK
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Expires: Thu, 01 Jan 1970 00:00:00 GMT
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Pragma: No-cache
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
Header:: Cache-Control: no-cache
2289 FATAL [main] (HttpTestBase.java:192) - Unexpected Exception of type java.net.MalformedURLException : no protocol: /emi/
java.net.MalformedURLException: no protocol: /emi/
at java.net.URL.<init>(URL.java:579)
at java.net.URL.<init>(URL.java:476)
at java.net.URL.<init>(URL.java:425)
at com.meterware.httpunit.WebResponse.processBaseTag(WebResponse.java:843)
at com.meterware.httpunit.WebResponse.readTags(WebResponse.java:834)
at com.meterware.httpunit.WebResponse.loadResponseText(WebResponse.java:815)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:58)
at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:60)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:154)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:117)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:110)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:133)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:119)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:110)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
at com.hypernoc.tests.httpunit.HttpTestBase.getResponse(HttpTestBase.java:115)
at com.hypernoc.tests.httpunit.HttpTestBase.setUp(HttpTestBase.java:181)
at junit.framework.TestCase.runBare(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:126)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.run(TestRunner.java:200)
at junit.textui.TestRunner.run(TestRunner.java:186)
at com.hypernoc.tests.UnitTestUtils.commandLineEntryPoint(UnitTestUtils.java:120)
The getResponse() method is very simple, line 114 just prints out the URL as shown on the log output, the WebConversation.getResponse() is called on line 115 as shown in the stack trace and so long as it isn't null the WebResponse is returned.
The only place that I see anything with "emi" in it is in the previous connection, when I get back:
I get a Malformed URL Exception while trying to setup form based authentication to a Tomcat 4.12 Server. The exception is coming from the code:
(HttpTestBase.java:177) log4j.info( "Posting j_security_check Form" );
(HttpTestBase.java:178) WebRequest request = form.getRequest();
(HttpTestBase.java:179) request.setParameter( "j_username", "administrator" );
(HttpTestBase.java:180) request.setParameter( "j_password", "administrator" );
(HttpTestBase.java:181) wr = getResponse( request );
I see the following in my log files:
2248 INFO [main] (HttpTestBase.java:177) - Posting j_security_check Form
2251 DEBUG [main] (HttpTestBase.java:114) - Connecting to http://localhost:8080/emi/security/j_security_check
Sending:: User-Agent: httpunit/1.4
Sending:: Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Accept-Encoding: gzip
Sending:: Referer: http://localhost:8080/emi/security/login.jsp;jsessionid=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Content-Type: application/x-www-form-urlencoded
Header:: HTTP/1.1 302 Moved Temporarily
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Content-Language: en-US
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
Header:: Location: http://localhost:8080/emi/index.jsp
Sending:: User-Agent: httpunit/1.4
Sending:: Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Accept-Encoding: gzip
Header:: HTTP/1.1 200 OK
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Expires: Thu, 01 Jan 1970 00:00:00 GMT
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Pragma: No-cache
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
Header:: Cache-Control: no-cache
2289 FATAL [main] (HttpTestBase.java:192) - Unexpected Exception of type java.net.MalformedURLException : no protocol: /emi/
java.net.MalformedURLException: no protocol: /emi/
at java.net.URL.<init>(URL.java:579)
at java.net.URL.<init>(URL.java:476)
at java.net.URL.<init>(URL.java:425)
at com.meterware.httpunit.WebResponse.processBaseTag(WebResponse.java:843)
at com.meterware.httpunit.WebResponse.readTags(WebResponse.java:834)
at com.meterware.httpunit.WebResponse.loadResponseText(WebResponse.java:815)
at com.meterware.httpunit.HttpWebResponse.<init>(HttpWebResponse.java:58)
at com.meterware.httpunit.WebConversation.newResponse(WebConversation.java:60)
at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:154)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:117)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:110)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:133)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:119)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:110)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
at com.hypernoc.tests.httpunit.HttpTestBase.getResponse(HttpTestBase.java:115)
at com.hypernoc.tests.httpunit.HttpTestBase.setUp(HttpTestBase.java:181)
at junit.framework.TestCase.runBare(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:126)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at junit.textui.TestRunner.doRun(TestRunner.java:74)
at junit.textui.TestRunner.run(TestRunner.java:200)
at junit.textui.TestRunner.run(TestRunner.java:186)
at com.hypernoc.tests.UnitTestUtils.commandLineEntryPoint(UnitTestUtils.java:120)
The getResponse() method is very simple, line 114 just prints out the URL as shown on the log output, the WebConversation.getResponse() is called on line 115 as shown in the stack trace and so long as it isn't null the WebResponse is returned.
The only place that I see anything with "emi" in it is in the previous connection, when I get back:
157 DEBUG [main] (HttpTestBase.java:105) - Connecting to http://localhost:8080/emi/index.jsp
Sending:: User-Agent: httpunit/1.4
Sending:: Accept-Encoding: gzip
Header:: HTTP/1.1 302 Moved Temporarily
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Expires: Thu, 01 Jan 1970 00:00:00 GMT
Header:: Content-Language: en-US
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Pragma: No-cache
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
Header:: Cache-Control: no-cache
Header:: Location: http://localhost:8080/emi/security/login.jsp;jsessionid=5D74D7480C954338A2BF6B3B7C0B766F
Header:: Set-Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F;Path=/emi
Sending:: User-Agent: httpunit/1.4
Sending:: Cookie: JSESSIONID=5D74D7480C954338A2BF6B3B7C0B766F
Sending:: Accept-Encoding: gzip
Header:: HTTP/1.1 200 OK
Header:: Content-Type: text/html;charset=ISO-8859-1
Header:: Date: Mon, 07 Apr 2003 17:01:16 GMT
Header:: Server: Apache Tomcat/4.1.12-LE-jdk14 (HTTP/1.1 Connector)
Header:: Transfer-Encoding: chunked
2211 DEBUG [main] (HttpTestBase.java:205) - RESPONSE from http://localhost:8080/emi/security/login.jsp;jsessionid=5D74D7480C954338A2BF6B3B7C0B766F :
Is this cookie path the cause of the exception or is it something else?
Any help would be appreciated,
Barry
OK, I think I've answered my own question. The HTML page I get back after authentication contains:
<html>
<head>
<base href='/emi/' />
So the WebResponse object is attempting to do new URL( "/emi/" ) which is throwing a MalformedURLException.
Isn't this valid HTML though?
Barry