kjkoster
01-01-2009, 21:24
Dear All,
If you do as I do and keep Tomcat's configuration in an SVN repository, you know that Tomcat has the habit of rewriting tomcat-users.xml (http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#MemoryRealm) all the time. It's not even just rewritten when it's changed, it gets rewritten every time, with the same data in a slightly different order. This means that you have to either not keep that file under version control, or deal with the non-changes that are introduced this way.
With version 5.5.12, this problem can be fixed by telling Tomcat to treat tomcat-users.xml as readonly. Just edit server.xml and add the flag readonly="true" to the appropriate resource (http://markmail.org/message/enncrcubmufecvno).
Here is how mine looks now, with the readonly flag marked in bold:
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container" readonly="true"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactor y"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
Tomcat now leaves that file alone.
Kees Jan
If you do as I do and keep Tomcat's configuration in an SVN repository, you know that Tomcat has the habit of rewriting tomcat-users.xml (http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#MemoryRealm) all the time. It's not even just rewritten when it's changed, it gets rewritten every time, with the same data in a slightly different order. This means that you have to either not keep that file under version control, or deal with the non-changes that are introduced this way.
With version 5.5.12, this problem can be fixed by telling Tomcat to treat tomcat-users.xml as readonly. Just edit server.xml and add the flag readonly="true" to the appropriate resource (http://markmail.org/message/enncrcubmufecvno).
Here is how mine looks now, with the readonly flag marked in bold:
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container" readonly="true"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactor y"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
Tomcat now leaves that file alone.
Kees Jan