FileChannel.tryLock() is dependent on the underlying file system. Not all file systems support locking. In our product we had to add support for attempting the lock, then if you get this failure, log it and move on. You are running unlocked at that point, but if something else is scribbling on the file then I figure that is user error, the application tried to lock it and told you it couldn't.
-Ken On Tuesday, September 8, 2015 at 10:36:02 AM UTC-5, Thomas Mueller wrote: > > Hi, > > It seems to be a limitation of the file system. Did you search for an > answer at StackOverflow.com? > > Regards, > Thomas > > On Sunday, September 6, 2015, alexg <[email protected] <javascript:>> > wrote: > >> Problem description: >> >> - h2 database server should start on OSX Yosemite >> - existinge database file is stored on OSX Snow Leopard and mounted as >> ntfs share on OSX Yosemite >> >> With the current version (1.4.188) of h2 database i debugged this >> Exception: >> >> java.io.IOException: Operation not supported >> >> at sun.nio.ch.FileDispatcherImpl.lock0(Native Method) >> >> at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:90) >> >> at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1082) >> >> at org.h2.store.fs.FileDisk.tryLock(FilePathDisk.java:447) >> >> at java.nio.channels.FileChannel.tryLock(FileChannel.java:1155) >> >> at org.h2.store.FileStore.tryLock(FileStore.java:491) >> >> at org.h2.store.PageStore.lockFile(PageStore.java:319) >> >> at org.h2.store.PageStore.openExisting(PageStore.java:343) >> >> at org.h2.store.PageStore.open(PageStore.java:288) >> >> at org.h2.engine.Database.getPageStore(Database.java:2448) >> >> at org.h2.engine.Database.open(Database.java:671) >> >> at org.h2.engine.Database.openDatabase(Database.java:268) >> >> at org.h2.engine.Database.<init>(Database.java:262) >> >> at org.h2.engine.Engine.openSession(Engine.java:65) >> >> at org.h2.engine.Engine.openSession(Engine.java:175) >> >> at org.h2.engine.Engine.createSessionAndValidate(Engine.java:153) >> >> at org.h2.engine.Engine.createSession(Engine.java:136) >> >> at org.h2.server.TcpServerThread.run(TcpServerThread.java:149) >> >> >> It has worked with some earlier version. It also works with database file >> stored on OSX Yosemite. >> >> -- >> >> -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
