jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes Tomcat overwrites tomcat-users.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat overwrites tomcat-users.xml" Watch "Tomcat overwrites tomcat-users.xml" New topic

Tomcat overwrites tomcat-users.xml

B Hollister

Joined: Oct 02, 2008
Posts: 3
I solved this before I got around to posting it, but since it's the reason I joined Java Ranch, I thought I'd post the issue and solution.

I installed Tomcat 6, and configured it, including adding an admin user to tomcat-users.xml. But each time I started Tomcat, it replaced the tomcat-users.xml.

After a few hours of learning about Realms and trying everything I could think of, I realized that the example copy of tomcat-users.xml has comment tags around the entries, and I had edited a copy of that but had missed the comment tags (editing in vi without the benefit of syntax highlighting).

Uncommenting the entries helped a lot! Tomcat still updates the file, but my entries remain. I'm using the default Realm settings (UserDatabaseRealm) that come in the default server.xml. Hope this post saves someone some grief!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

Instead of hand-editing the file you could also use the Admin web app that comes with Tomcat. That modifies the file as well, and thus saves you from this problem.
B Hollister

Joined: Oct 02, 2008
Posts: 3
That's a good idea, since it would save me from myself. I got in the habit of editing server.xml directly in a previous project, because there was a command I needed that wasn't supported in the Admin app.

Anyway, from what I've seen, there isn't an Admin app for Tomcat 6, at least not yet. And the Admin app for 5.5 isn't suggested for use with 6.
I agree. Here's the link: http://aspose.com/file-tools
subject: Tomcat overwrites tomcat-users.xml
It's not a secret anymore!