tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23675] New: - Ajp13Connector contains code that works only on JDK1.3+
Date Wed, 08 Oct 2003 15:50:31 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23675>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23675

Ajp13Connector contains code that works only on JDK1.3+

           Summary: Ajp13Connector contains code that works only on JDK1.3+
           Product: Tomcat 4
           Version: 4.1.27
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:JK/AJP (deprecated)
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: ed.randall@ingenotech.com


When using JDK1.2.2 and Apache 1.3 connected to Tomcat via mod_jk/AJP13, 
the servlet hangs and you get the following error:-

java.lang.NoSuchMethodError: java.net.Socket: method setKeepAlive(Z)V not found
	at org.apache.ajp.tomcat4.Ajp13Connector.run(Compiled Code)
	at java.lang.Thread.run(Thread.java:479)

Tomcat 4 claims to work on any platform using JDK1.2 or higher;  Unfortunately
the call to Socket.setKeepAlive prevents this, since setKeepAlive is a method
that only came into existance with JDK1.3, this causes a problem on platforms
for which JDK1.2 is the best available or where maybe JDK1.2 has to be used for
some other reason.

I have successfully tested the following patch to 
jakarta-tomcat-connectors-4.1.27-src/
jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java 
with JDKs 1.2.2, 1.3 and 1.4, whilst the source doesn't compile on 1.2, it will
run successfully :-

*** Ajp13Connector.java Thu Jul 31 18:30:40 2003
--- Ajp13Connector.java.new     Wed Oct  8 16:42:22 2003
***************
*** 857,862 ****
--- 857,878 ----
       */
      public void run() {
  
+         boolean hasSOKeepAlive = false;
+         try
+         {
+             java.lang.reflect.Method m = Socket.class.getMethod
("setKeepAlive", new Class[] { boolean.class } );
+             if (m != null)
+             {
+                 hasSOKeepAlive = true;  
+             }          
+         }
+         catch(Exception ex)
+         {
+         }
+         
+         System.out.println("hasSOKeepAlive = "+hasSOKeepAlive);
+ 
+         
          // Loop until we receive a shutdown command
        while (!stopped) {
  
***************
*** 892,897 ****
--- 908,914 ----
                  else
                        socket.setSoLinger(true, connectionLinger);
                  
+                 if (hasSOKeepAlive)
                      socket.setKeepAlive(true);

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


Mime
View raw message