Bug 49436 - Documented default for UserDatabase readonly attribute wrong
Documented default for UserDatabase readonly attribute wrong
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.26
PC Windows XP
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-06-14 14:03 UTC by David Tugby
Modified: 2014-02-17 13:54 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Tugby 2010-06-14 14:03:54 UTC
In version 6.0.26 org.apache.catalina.users.MemoryUserDatabase sets readonly = true. In version 5.5.29 org.apache.catalina.users.MemoryUserDatabase sets readonly = false. This means that the save method will default to logging an error message rather than saving the user database file.

    public void save()
        throws Exception
    {
        if(getReadonly())
        {
            log.error(sm.getString("memoryUserDatabase.readOnly"));
            return;
        }

The message that is displayed in 6.0.26 is:
memoryUserDatabase.readOnly=User database has been configured to be read only. Changes cannot be saved

I cannot find any documentation or a JMX management bean to set readonly = false.
Hence the save method I was using in Tomcat 5.0.28 and tomcat 5.5.29 no longer works.

David Tugby
Comment 1 Mark Thomas 2010-06-14 16:32:13 UTC
Tomcat home page...
  http://tomcat.apache.org/

...which links to the Tomcat 6 docs...
  http://tomcat.apache.org/tomcat-6.0-doc/index.html

...which has a link for configuration...
  http://tomcat.apache.org/tomcat-6.0-doc/config/index.html

...which documents Realms...
  http://tomcat.apache.org/tomcat-6.0-doc/config/realm.html

...including the UserDatabaseRealm which in turn links to the JNDI how-to...
  http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#UserDatabase%20Resources

...which describes how to set the readonly attribute.
Comment 2 David Tugby 2010-06-15 07:39:48 UTC
Thanks. 

Got this working by pasting the entire entry from http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#UserDatabase%20Resources into my server.xml file. So I must have entered a typo when I tried earlier.

The documentation is not quite correct however.
tomcat-6.0-doc/jndi-resources-howto.html states
"The readonly attribute is optional and defaults to false if not supplied."

In my humble opionion this should be changed to:
"The readonly attribute is optional and defaults to true if not supplied."

Thanks again for the prompt response.

David Tugby
Comment 3 Mark Thomas 2010-06-18 06:43:28 UTC
Docs updated for 7.0.x and 6.0.x. Fix will be included in 7.0.1 and 6.0.28 onwards.