tomcat-users.xml; what a difference a space made
Archive - Originally posted on "The Horse's Mouth" - 2009-01-16 06:19:44 - Graham EllisProduct: Apache Tomcat release 6.0.something
Symptom: After some fine tuning of the configuration files, a working installation was no longer working ... requests for web pages resulted in the browser hanging and waiting, in perpituity it seemed, for a response. In other words, the connection was being made to the port but no response returned.
Analysis / solution: It turns out that extra (spurious) spaces between the "<" and the tag name in the tomcat-user.xml file were causing the problem.
Wrong (failed as described):
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
< role rolename="manager"/>
< user username="trainee" password="abc123" roles="manager"/>
</tomcat-users>
Right (working):
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<user username="trainee" password="abc123" roles="manager"/>
</tomcat-users>
Background: The tomcat-users.xml file provides one quick and easy way of providing a login capability to the Tomcat Manager application which allows you to see how your server is running 'on the fly', and to stop and start and deploy web applications individually rather than controlling them simply by stopping and starting the whole server!
Learn More: On our Deploying Apache Httpd and Tomcat course.