|Summary:||Embeded Tomcat using a Connector with a random port (port 0)|
|Product:||Tomcat 7||Reporter:||olamy <olamy>|
|Component:||Connectors||Assignee:||Tomcat Developers Mailing List <dev>|
|Attachments:||v1 patch for discussion|
Description olamy 2011-10-14 12:27:22 UTC
New feature based on discussion: http://markmail.org/message/3nczqiqm6smez255
Comment 1 Mark Thomas 2011-10-28 17:52:55 UTC
Created attachment 27861 [details] v1 patch for discussion I have started to look at this and it looks doable. port=0 works for all connectors for 64-bit Windows. The problem is with MBean names, JMX MBean registration and logging info. The port number is not available at the point where the JMX registration occurs. If bindOnInit="false", the port number may change multiple times during the life of the connector. With multiple connectors using port="0" there will be a naming clash as the connectors need to be registered before the the ports are known. I see two options. 1. Use auto-1, auto-2 instead of the port number in the JMX names (with a static, thread-safe counter). 2. Re-register the connector and related components when the port number changes. I'm leaning towards one as it is a heck of a lot simpler. Thoughts?
Comment 2 Mark Thomas 2011-11-28 23:20:32 UTC
This has been fixed in trunk and back-ported to 7.0.x. It will be included in 7.0.24 onwards.