Search code examples
db4o

Db4O - DatabaseFileLockedException when restarting server


I am developing VAADIN using Db4O for storage. Normally, I love the fact that I can change the source code, save it, and voi-lá: the server gets automatically restarted and I can see the changes in the browser.

But always when I restart the tomcat server I get a DatabaseFileLockedException. My workaround is to stop the server, and start it again. But doing this manually every 1 minute is annoying.

INFO: I am using the client server configuration, but the VAADIN application itself is the DB4O server (other applications get connected to it):

ServerConfiguration serverConfig = Db4oClientServer.newServerConfiguration();
//Configure server...
ObjectServer server = Db4oClientServer.openServer(serverConfig, DBFILE, PORT);
server.grantAccess(...); //GRANT ACCESS TO OTHER APPLICATIONS

//LOCAL USE ONLY:

 private ObjectContainer client = server.openClient();
//PS.: I never close the client locally. Can that be a problem?

Does someone know how to get rid of this?

Thanks in advance.


Solution

  • Hmm, do you even close the server. Otherwise the db4o server will keep running and produce this exception.

    Is there some 'shutdown'-callback in VAADIN? Thats usually the place to close the db4o server. When you close the server all local and remote client connections will be shut down aswell or will throw an exception when accessing them the next time.