Hi Remy,
so would it be OK, if I produce a patch, that cares about the Exception
and logs a message instead? I could make that configurable if you think
there is too much danger for a user to loose changes because he was able
to start tomcat and didn't notice the database was not writable.
I will propose a patch later that week and you can have a look at it.
By the way: I think Mladen also wanted such a behaviour and just now
there is a user on the users list who ran into trouble because of the
needed write permissions (not easy to understand/believe, that the file
is needed to be written during startup).
Rainer
Remy Maucherat wrote:
Rainer Jung wrote:
Hi,
I wonder, why
/org/apache/catalina/users/MemoryUserDatabaseFactory.java
saves the MemoryUserDatabase directly after opening it:
public Object getObjectInstance(Object obj, Name name, Context
nameCtx, Hashtable environment) throws Exception {
...
// Return the configured database instance
database.open();
database.save();
return (database);
}
That means, the runtime user of tomcat needs write permissions on the
directory, the file is in (see the implementation of
MemoryUserDatabase.save()).
Ogf course in case one likes to administer the user database the save
function is necessary. But there are two cases where one would prefer to
have tomcat not trying to save the database during startup:
1) Running tomcat from CD
2) Having a very secure setup of tomcat, where all the configs are write
disabled.
The call to database.save() is in the code since the very first version
in TC 4, but I can't really see, why it is necessary.
Another possibility would be to catch the Exception thrown when there is
no write permission and to simply log a warning.
Also: there is a save() done in close(). I don't know, where the close
is called from, but it looks like nowhere in catalina code (eventually
in admin).
Any comments? Thanks!
The problem is (mostly) the save in close: the database can't know for
sure if its stuff was updated so it always saves.
I understand the need for 1), which can be achieved with the other
equivalent-but-not-management-friendly memory realm. 2) seems unlikely IMO.
Rémy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]