One case I can think of database disk is full and system is unable to create even a lock (db.lck) file also. In derby , there is this logic that declares database is read only , when it is not able to create files. Idea is to boot database in jar files ..etc in read only mode . If file creation IO error happens to occur , before it load the log factory is loaded , then it boots the read only verion of the log factory implementation, thinking that databse is read only.
you may want to look at the following code to see , if this is what is happening in u'r case:
private void bootLogFactory(boolean create, Properties startParams) throws StandardException
logFactory = (LogFactory) Monitor.bootServiceModule(create, this,
2) boot() method
3) ,private void privGetJBMSLockOnDB() throws StandardException this method marks the database as readonly , if it is not able to create db.lck files.
Marking database on disk full case seems to be incorrect as u mentioned. Problem here is ,we want to automatically figure out the read only databases, but java does not seem have a DiskFull exception!!