Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat overwrites tomcat-users.xml

 
B Hollister
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic