We've recently had some of customer reports come in where Derby is failing with problems related to "service.properties". There are three different cases but all appear to be similar:
Case 1: "ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold' " is thrown when trying to call SYSCS_DISABLE_LOG_ARCHIVE_MODE(1). Both "service.properties" and "service.propertiesold" are present in the database directory. Removing "service.propertiesold" corrects the problem. Case 2: "SQLException: Database 'C:\PATH_TO_DB' not found" is thrown when booting the database. The file service.properties does not exist in the database directory but service.propertiesold does exist. Renaming the file back to "service.properties" corrects the problem. Case 3: Same as Case 2, except both "service.properties" and "service.propertiesold" are missing. We will probably use a backup to restore service.properties in this case. In all cases there are no errors logged from the database prior to the problems above. I suspect derby has been terminated or interrupted while updating the service.properties file and left the file system in an inconsistent state. Although I imagine the window for this to happen would be fairly narrow. As far as I can tell the call to SYSCS_DISABLE_LOG_ARCHIVE_MODE(1), which is called during our nightly maintenance task, is the only place in our application which updates service.properties. Fortunately this call is no longer needed so we have removed it. Does this assessment sound reasonable? Are there any other steps we should be taking to avoid this problem? I've included details of the customer environments and full exception details below. Thanks, Brett. The details: Environment: - Derby 10.6.1.0 - Sun JavaSE 1.6 update 20 32-bit. - Windows XP/7 Exception 1: Caused by: java.sql.SQLException: The exception 'org.apache.derby.iapi.error.PassThroughException: ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold'' was thrown while evaluating an expression. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknow n Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source) at org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(Unknown Source) ... 43 more Caused by: java.sql.SQLException: The exception 'org.apache.derby.iapi.error.PassThroughException: ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold'' was thrown while evaluating an expression. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossD RDA(Unknown Source) ... 53 more Caused by: java.sql.SQLException: Java exception: 'ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold': org.apache.derby.iapi.error.PassThroughException'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossD RDA(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknow n Source) ... 50 more Caused by: org.apache.derby.iapi.error.PassThroughException: ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold' at org.apache.derby.impl.services.monitor.UpdateServiceProperties.update(Unknow n Source) at org.apache.derby.impl.services.monitor.UpdateServiceProperties.put(Unknown Source) at org.apache.derby.impl.store.access.PropertyConglomerate.saveServiceProperty( Unknown Source) at org.apache.derby.impl.store.access.PropertyConglomerate.saveProperty(Unknown Source) at org.apache.derby.impl.store.access.PropertyConglomerate.setProperty(Unknown Source) at org.apache.derby.impl.store.access.RAMTransaction.setProperty(Unknown Source) at org.apache.derby.impl.store.raw.log.LogToFile.disableLogArchiveMode(Unknown Source) at org.apache.derby.impl.store.raw.RawStore.disableLogArchiveMode(Unknown Source) at org.apache.derby.impl.store.access.RAMAccessManager.disableLogArchiveMode(Un known Source) at org.apache.derby.impl.db.BasicDatabase.disableLogArchiveMode(Unknown Source) at org.apache.derby.catalog.SystemProcedures.SYSCS_DISABLE_LOG_ARCHIVE_MODE(Unk nown Source) at org.apache.derby.exe.acf477c2e6x012dxb876xe76exffffcae058941.g0(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.derby.impl.services.reflect.ReflectMethod.invoke(Unknown Source) at org.apache.derby.impl.sql.execute.CallStatementResultSet.open(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source) at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source) ... 46 more Caused by: ERROR XBM0S: Unable to rename file 'C:\PATH_TO_DB\service.properties' to 'C:\PATH_TO_DB\service.propertiesold' at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.services.monitor.StorageFactoryService$5.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.derby.impl.services.monitor.StorageFactoryService.saveServiceProp erties(Unknown Source) ... 66 more Exception 2: Caused by: java.sql.SQLException: Database 'C:\PATH_TO_DB' not found. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleDBNotFound(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection30.<init>(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection40.<init>(Unknown Source) at org.apache.derby.jdbc.Driver40.getNewEmbedConnection(Unknown Source) at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source) at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source) at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(Unknown Source) at com.ADInstruments.LTS.dataAccess.ConnectionFactory.openConnection(Unknown Source) ... 10 more Caused by: java.sql.SQLException: Database 'C:\PATH_TO_DB' not found. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossD RDA(Unknown Source) ... 24 more