Earlier this week I got an email from John Tangney, a user of nntp//rss, reporting a problem running the latest release on Mac OS X. After some investigation, it materializes that the problem is actually related to Apache Derby, the new embedded database within nntp//rss as of v0.5-beta-1.
Derby was failing on the first startup, with the following exception written to derby.log:
java.io.FileNotFoundException: /usr/local/nntprss-0.5-beta-1/nntprssdb/log/log1.dat (File exists)
at java.io.RandomAccessFile.open(Native Method)
A bit of prodding around in the Derby code showed that it was trying to initialize its subclass of java.io.RandomAccessFile with the sync mode ‘rws’. I had not experienced any difficulties on Windows or Linux with Derby, so I started up a copy on Mac OS X 10.3.6, and, low and behold, got the same exception. A bit of judicious Googling finally turned up this IBM developerWorks forum post. Looking in Apache JIRA, I found this report (and extensive conversation) related to the bug, which basically identifies it as a Mac JVM issue. Unfortunately, to date, there has been no resolution from Apple.
Fortunately Derby has a property, derby.storage.fileSyncTransactionLog, which can be set to true to workaround this issue. For example, nntp//rss on Mac OS X should be started with the following command:
java -Dderby.storage.fileSyncTransactionLog=true -jar nntprss-start.jar
If you’re developing a Mac OS X application using Derby, you can also set this property within your code, before initializing the Derby driver. The System-Wide Properties section of the Derby documentation provides more details.