I am inquiring about the algorithm Tomcat uses for processing the
server.xmlfile on startup.

When Tomcat is started, it processes all hosts listed in the server.xml file
for catalina policy compliance. Issues arise when there is an account that
does not comply with our policy file and Tomcat refuses to start up. 90% of
the time, it prints the host it is processing just prior to error. This
obviously allows us to disable that host, and Tomcat will start.

However, the other 10% of the time, it will print an error and not specify
the host it is processing that caused that error. Therefore, we are unable
to determine which host to disable.

This results in having to do a binary search on the server.xml, commenting
out large chunks of hosts until a single culprit is left. On this latter
10%, it will print the last successful host processed prior to the error...
but this does not help, as we can not determine the next host in succession.

I would assume that Tomcat processes the hosts on startup in the order they
lie in the server.xml file. However, that is not the case. They jump all
over the place. An example would be:

<Host name='domain.com'
debug='0'
appBase='/path/to/java/app'
unpackWARs='true'
autoDeploy='false'>
<Alias>www.domain.com</Alias>
<Context path='' docBase='' debug='0' reloadable='false'/>
<Valve  className='org.apache.catalina.authenticator.SingleSignOn'
debug='0'/>
<Valve  className='org.apache.catalina.valves.AccessLogValve'
directory=''
prefix='tomcat_access.'
suffix='.log'
pattern='common'
resolveHosts='false'/>
</Host>


We have a fair number of hosts on each java box. It neither sorts the
server.xml by alphabetic order, or file succession as it will skip from host
32, to 864, to 1026, to 127, etc... (jumping all over the place).

Can anyone explain the server.xml sorting algorithm Tomcat uses on start?

Regards,

-Kyle

Reply via email to