Bug 49436

Summary: Documented default for UserDatabase readonly attribute wrong
Product: Tomcat 6 Reporter: David Tugby <david.tugby>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 6.0.26   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

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

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...

...which links to the Tomcat 6 docs...

...which has a link for configuration...

...which documents Realms...

...including the UserDatabaseRealm which in turn links to the JNDI how-to...

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

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.