java.nio.channels.OverlappingFileLockException

#1

Hello,

whenever I re-deploy my web application in Sun Java System Web Server, I get the following exception and the application cannot run anymore. Any clue what I am doing wrong? 

I use the file-based db access (local to the web app, as described in your tutorial).

Thanks for pointers!

Best, Benjamin

java.nio.channels.OverlappingFileLockException
     at sun.nio.ch.FileChannelImpl$SharedFileLockTable.checkList(FileChannelImpl.java:1176)
     at sun.nio.ch.FileChannelImpl$SharedFileLockTable.add(FileChannelImpl.java:1078)
     at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:878)
     at java.nio.channels.FileChannel.tryLock(FileChannel.java:962)
     at com.objectdb.o.LFL.N(LFL.java:892)
     at com.objectdb.o.LFL.H(LFL.java:843)
     at com.objectdb.o.LFL.H(LFL.java:753)
     at com.objectdb.o.SFL.<init>(SFL.java:212)
     at com.objectdb.o.MST.<init>(MST.java:111)
     at com.objectdb.o.MST.aG(MST.java:96)
     at com.objectdb.o.MSF.UH(MSF.java:167)
     at com.objectdb.o.OMF.ai(OMF.java:725)
     at com.objectdb.jpa.EMF.ai(EMF.java:143)
     at com.objectdb.o.OMF.ah(OMF.java:681)
     at com.objectdb.jpa.EMF.createEntityManager(EMF.java:160)
     at net.pocketservices.athene.ObjectDB.createEntityManager(ObjectDB.java:32)
     at net.pocketservices.athene.pages.base.BasePage.<init>(BasePage.java:71)
     at net.pocketservices.athene.pages.base.UserPage.<init>(UserPage.java:22)
     at net.pocketservices.athene.pages.user.LoginPage.<init>(LoginPage.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:192)
     at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57)
     at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
     at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
     at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
     at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
     at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
     at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
     at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
     at com.sun.webserver.connector.nsapi.NSAPIProcessor.service(NSAPIProcessor.java:160)
#2

The exception indicates a file locking conflict.

In embedded mode the database cannot be opened by more than one user (process / class loader) simultaneously.

Please verify that the database is not open by another process - e.g. the ObjectDB Explorer.

If the database is not in use by another user you may want to try the solution in this forum thread.

If the problem is not solved you may consider switching to client server mode.

 

ObjectDB Support
#3

The fix to this is to make sure you only have this line once in the application:

    EntityManagerFactory entityManagerFactory = 
        Persistence.createEntityManagerFactory("$objectdb/database/myapp.odb");
#4

It makes sense. Thank you for this tip.

ObjectDB Support

Reply