2 Replies Latest reply on Jan 23, 2012 11:32 AM by Stefano Nichele

    CatalinaConnector.setAddress not working with Tomcat <= 6.0.14

    Stefano Nichele Newbie

      Hi all,

      i'm using tomcat 6.01.3 and i found that CatalinaConnector.setAddress throws a NoSuchMethodError when mod-cluster calls:

       

      IntrospectionUtils.setProperty(this.connector.getProtocolHandler(), "address", address.getHostAddress());

       

      Looking at the tomcat source code, i saw that, since 6.0.15, IntrospectionUtils.setProperty returns a boolean and indeed this is the version needed by mod-cluster. At the end, i would like to suggest this small changes in CatalinaConnector.setAddress:

       

      try {

          IntrospectionUtils.setProperty(this.connector.getProtocolHandler(), "address", address.getHostAddress());

      } catch (NoSuchMethodError err) {

          // this works on Tomcat <= 6.0.14

          this.connector.getProtocolHandler().setAttribute("address", address.getHostAddress());

      }

       

      instead of just:

       

      IntrospectionUtils.setProperty(this.connector.getProtocolHandler(), "address", address.getHostAddress());

       

      I'm not sure if there is a better way to fix the issue, and i don't know if you are interested in fixing an issue for a such old tomcat version, but i think the proposed solution is really easy and without risks for the other working and most recent versions (and it is very useful for the ones stuck on old tomcats as me :-) )

       

      What do you think ?

      Thanks in advance

      ste