Db4o and OSGi - empty database after reboot

I am using db4o 6.4.54 in OSGi environment as my model store. Every time I restart the OSGi framework, the database appears to be empty, although the file is not empty.

I have the following configuration:

A kernel that depends on the standard db4o_osgi package provided by db4o. A UI package that depends on the main plugin where it gets the model from.

The main package creates a server with memory via the openServer (String, 0) method and then creates separate clients for each request / thread.

The problem is that every time the db4o server is created, the queries do not return a result.

I tried using the service, but it also didn't work.

The next step in my testing was to include db4o directly in my package and it worked (the effect was that the db4o classes are loaded with the same classloader as the model object that I saved to the database). There is one post in the db4o forum [1], but it cannot explain why this problem exists and how it should be solved (correctly). I will continue my research, but I wonder if anyone else has changed their mind about this question in front of me?

0


source to share


1 answer


Did you commit the changes and close the client connection when you close the osgi package?

For example: sth like



ObjectContainer client;

public void start(BundleContext context) throws Exception {
   client = Db4oClientServer.openClient(...);
}    

public void stop(BundleContext context) throws Exception {
   if (!client.ext().isClosed())
      client.close();
}

      

Or take a look at my standalone Db4oServer , which may receive a "STOP" message from a client that needs to be stopped.

+1


source







All Articles