You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Rick Bullotta <ri...@lighthammer.com> on 2003/02/25 17:41:16 UTC

Possible Socket Handling Bug? : Applet Cannot Make HTTP POST Request to Tomcat w/IIS Redirector

Here's the Tomcat/redirector bug we're trying to track down:

Our applets/servlets run perfectly with Tomcat 4.1.18 and Apache 2.0.4X
(using jk as the go-between), but when used with the IIS redirector and
jk, the applets are unable to do any HTTP POST requests.  Applets can,
however, successfully issue GET requests.  There's nothing unusual about
the applet code, a snippet is shown below.  The code blocks on the
oStrm.close() method.  It works perfectly when using the Apache Http
server.  Also provided is the stderr.log output.  The stdout.log output
also contains some dump of what appears to be the HTTP content.
Unfortunately, we do have clients that will need the IIS/Tomcat combo.

This one is causing great hair loss, and any help welcomed. ;>

Applet code snippet:
====================
		sURL = ...
		sPostData = ...

		URL url = new URL(sURL);
			
            URLConnection urlconnection = url.openConnection();

            urlconnection.setDoInput(true);
            urlconnection.setDoOutput(true);
            urlconnection.setUseCaches(false);
	
urlconnection.setRequestProperty("Content-Type","application/x-www-form-
urlencoded");

            System.out.println("Getting Output Stream");

		DataOutputStream oStrm = new
DataOutputStream(urlconnection.getOutputStream());

            System.out.println("Got Output Stream");
		oStrm.writeBytes(sPostData);
            System.out.println("Wrote Stream");
            oStrm.flush();
            System.out.println("Flushed Output Stream");
            oStrm.close();
            System.out.println("Closed Output Stream");

		DataInputStream iStrm = new DataInputStream(new
BufferedInputStream(urlconnection.getInputStream(), 8192));

            int nSuccessCode = iStrm.readInt();

		...
=====================

stderr.log output:

=====================
SEVERE: Error decoding request 
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at
java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
	at
java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
	at
java.io.BufferedInputStream.read(BufferedInputStream.java:277)
	at
org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:526)
	at
org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:464)
	at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:625)
	at
org.apache.jk.common.JkInputStream.receive(JkInputStream.java:300)
	at
org.apache.jk.common.HandlerRequest.decodeRequest(HandlerRequest.java:46
1)
	at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:343)
	at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:632)
	at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
590)
	at
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:707)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:530)
	at java.lang.Thread.run(Thread.java:536)
Feb 25, 2003 9:55:27 AM org.apache.jk.common.ChannelSocket
processConnection
WARNING: processCallbacks status 2
=====================

stdout.log content:

=====================12 34 01 2a 02 04 00 08 48 54 54 50 2f 31 2e 31  |
.4.*....HTTP/1.1 00 00 14 2f 73 65 72 76 6c 65 74 2f 49 6c 6c 75  |
.../servlet/Illu 6d 69 6e 61 74 6f 72 00 00 09 31 32 37 2e 30 2e  |
minator...127.0. 30 2e 31 00 00 09 31 32 37 2e 30 2e 30 2e 31 00  |
0.1...127.0.0.1. 00 09 6c 6f 63 61 6c 68 6f 73 74 00 00 50 00 00  |
..localhost..P.. 08 a0 01 00 34 74 65 78 74 2f 68 74 6d 6c 2c 20  |
.?..4text/html, 
69 6d 61 67 65 2f 67 69 66 2c 20 69 6d 61 67 65  | image/gif, image 2f
6a 70 65 67 2c 20 2a 3b 20 71 3d 2e 32 2c 20  | /jpeg, *; q=.2, 
2a 2f 2a 3b 20 71 3d 2e 32 00 a0 04 00 02 65 6e  | */*; q=.2.?...en 00
a0 06 00 0a 4b 65 65 70 2d 41 6c 69 76 65 00  | .?...Keep-Alive. a0 0b
00 09 6c 6f 63 61 6c 68 6f 73 74 00 a0 0e  | ?...localhost.?. 00 29 4d
6f 7a 69 6c 6c 61 2f 34 2e 30 20 28 63  | .)Mozilla/4.0 (c 6f 6d 70 61
74 69 62 6c 65 3b 20 4d 53 49 45 20  | ompatible; MSIE 
36 2e 30 3b 20 57 69 6e 33 32 29 00 a0 08 00 03  | 6.0; Win32).?... 31
30 32 00 a0 07 00 21 61 70 70 6c 69 63 61 74  | 102.?..!applicat 69 6f
6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75  | ion/x-www-form-u 72 6c 65
6e 63 6f 64 65 64 00 00 0d 63 61 63 68  | rlencoded...cach 65 2d 63 6f
6e 74 72 6f 6c 00 00 08 6e 6f 2d 63  | e-control...no-c
61 63 68 65 00 03 00 00 00 04 00 00 00 ff        | ache.........?
=====================

Iis_redirect.log content:

=====================
[Tue Feb 25 10:01:30 2003]  [jk_connect.c (158)]: Into jk_open_socket
[Tue Feb 25 10:01:30 2003]  [jk_connect.c (165)]: jk_open_socket, try to
connect socket = 1084 [Tue Feb 25 10:01:30 2003]  [jk_connect.c (174)]:
jk_open_socket, after connect ret = 0 [Tue Feb 25 10:01:30 2003]
[jk_connect.c (183)]: jk_open_socket, set TCP_NODELAY to on [Tue Feb 25
10:01:30 2003]  [jk_connect.c (200)]: jk_open_socket, return, sd = 1084
[Tue Feb 25 10:01:30 2003]  [jk_ajp_common.c (614)]: In
jk_endpoint_t::ajp_connect_to_endpoint, connected sd = 1084 [Tue Feb 25
10:01:30 2003]  [jk_ajp_common.c (642)]: sending to ajp13 #301 [Tue Feb
25 10:01:30 2003]  [jk_ajp_common.c (884)]: ajp_send_request 2: request
body to send 77 - request body to resend 0 [Tue Feb 25 10:01:30 2003]
[jk_isapi_plugin.c (514)]: Into jk_ws_service_t::read [Tue Feb 25
10:01:30 2003]  [jk_isapi_plugin.c (548)]: jk_ws_service_t::read,
ReadClient failed [Tue Feb 25 10:01:30 2003]  [jk_ajp_common.c (806)]:
ERROR: receiving data from server failed, the client aborted the
connection or network errors. [Tue Feb 25 10:01:30 2003]
[jk_ajp_common.c (1190)]: sending request to tomcat failed in send loop.
err=2 [Tue Feb 25 10:01:30 2003]  [jk_ajp_common.c (1198)]: Error
connecting to tomcat. Tomcat is probably not started or is listenning on
the wrong port. Failed errno = 22 [Tue Feb 25 10:01:30 2003]
[jk_isapi_plugin.c (998)]: HttpExtensionProc error, service() failed
[Tue Feb 25 10:01:30 2003]  [jk_ajp_common.c (1388)]: Into
jk_endpoint_t::done, closing connection 0 [Tue Feb 25 10:01:30 2003]
[jk_ajp_common.c (561)]: In jk_endpoint_t::ajp_close_endpoint
=====================

Rick Bullotta
CTO
Lighthammer Software (http://www.lighthammer.com)



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org