Hi Thomas,

if a Restlet (Application, ...) is stopped, its stop() method is called. Ensure, that you call super.stop(). I think, you should typically call this as last statement in this method.

best regards
  Stephan

Thomas schrieb:
Hello,

I've got some troubles concerning the integration of a database into a webservice. The whole service is running on a Tomcat server, the database is a db4o. When I stop and restart the server I can't access the dbo file I once created, because the file isn't closed properly. So how or where can I manage the closing of the db4o objectcontainer, when the server stops running. Are there any ServletListener like methods, which handle the closing of the db? I tried to in the main method of the application, but it didn't work,

 public static void main(String[] args) throws Exception {
        // Create a component with an HTTP server connector
        Component comp = new Component();
        comp.getServers().add(Protocol.HTTP, 8080);
        comp.getClients().add(Protocol.FILE);

comp.getDefaultHost().attach("", new Application(comp.getContext()));
        comp.start();

        // Close the database, when the server shuts down
        if (comp.isStopped()) {
            container.close();
        }
 }

thanks for your help,
Thomas

Reply via email to