Apache Derby on Mac OS X
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)
at java.io.RandomAccessFile.
at org.apache.derby.impl.io.DirRandomAccessFile.
at org.apache.derby.impl.io.DirRandomAccessFile4.
...
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.
1 TrackBacks
Listed below are links to blogs that reference this entry: Apache Derby on Mac OS X.
TrackBack URL for this entry: http://www.jasonbrome.com/mt/mt-tb.cgi/49
Derby is hit by a bug in the Mac JVM which can be worked around - see this post http://www.jasonbrome.com/blog/archives/2004/12/05/apache_derby_on_mac_os_x.html Read More
This is no longer an issue in Mac OS X v10.4 Tiger.
It is still an issue with Tiger, on Java 1.5 but not 1.4.x. See: http://db.apache.org/derby/faq.html