There is a feature in org.apache.jk.server.JkCoyoteHandler implementation of AJP/1.3 protocol: when connector fails to bind to the specified port, it does not fail immediately but will try next available port number. This was previously discussed in the following threads: http://marc.info/?t=126402175600004&r=1&w=2 http://marc.info/?t=119266320200003&r=1&w=2 This feature is implemented in the org.apache.jk.common.ChannelSocket and ChannelNioSocket classes and can be controlled by setting channelSocket.maxPort property on a <Connector/>, but there is a bug: ChannelSocket#setPort(int) resets the value of maxPort, and thus the final configuration is dependent on the order in which the XML attributes were processed. This concerns only JkCoyoteHandler implementation of the protocol, present in Tomcat 5.5 and 6.0. The new AjpProtocol implementation present in 6.0 and used by default in Tomcat 7.0, as well AjpAprProtocol are not affected.
Created attachment 25657 [details] 2010-06-29_tc6_maxPort.patch Patch for tc6.0.x It does the following: - implements <Connector maxPort=""/> as a synonym for <Connector channelSocket.maxPort=""/> - implements workaround for this issue, so that the channelSocket.maxPort property, if present, is applied later than the others
Comment on attachment 25657 [details] 2010-06-29_tc6_maxPort.patch Proposed a different patch for 6.0 and 5.5
Fixed in 6.0.x and will be included in 6.0.30 onwards.
Fixed in 5.5.x and will be in 5.5.32 onwards.