I'm using the server with an in memory db because we want to be able
to run the application and still view/modify the db using the servlet
console or other connections.

Since the db is in memory only, it should go away once the server goes
down. Regardless I don't think the error is because the in memory db
is still there. If you look thought the stack track you'll see this:

 at org.h2.jdbc.JdbcConnection.close

So it looks like the error comes about when the servlet is trying to
shut the db down, but it can't because the connection is already
closed.  This isn't really a problem, but showing a stack trace is
causing some concerns my team.




On Feb 15, 1:06 pm, Thomas Mueller <thomas.tom.muel...@gmail.com>
wrote:
> Hi,
>
> You are using the server mode. That means the database "lives" on the
> server side (the server can be in the same process as the client, or
> in a different process). If the server is closed, the server is
> stopped, and therefore the TCP listener is closed. Could it be this
> problem? At least the exception message says "Connection is broken".
> This is not because the database is closed, but because the server is
> stopped.
>
> I guess the database is still alive actually, just the server that is closed.
>
> Why do you use the server mode?
>
> Regards
> Thomas
>
> On Wed, Feb 15, 2012 at 5:13 PM, zaraki kenpachi
>
>
>
>
>
>
>
> <jaggerjackkuros...@gmail.com> wrote:
> > I tried the following:
>
> > 1. Started web app with mvn jetty:run
> > 2. Opened the console (servet)
> > 3. SET DB_CLOSE_ON_EXIT=FALSE
> > 4. Shutdown Jetty
>
> > I got the same error, but here it is with the debugging in case that
> > has a clue that I'm overlooking:
>
> > **/dbMeta0.getDatabaseProductName();
> > 02-15 09:36:47 jdbc:
> > /**/dbMeta0.getDatabaseProductVersion();
> > 02-15 09:37:02 jdbc:
> > /**/Statement stat5 = conn4.createStatement(1004, 1008);
> > 02-15 09:37:02 jdbc:
> > /**/stat5.setMaxRows(1000);
> > 02-15 09:37:02 jdbc:
> > /**/stat5.execute("SET DB_CLOSE_ON_EXIT=FALSE");
> > 02-15 09:37:02 jdbc: SESSION_PREPARE_READ_PARAMS 70
> > 02-15 09:37:02 jdbc: COMMAND_EXECUTE_UPDATE 70
> > 02-15 09:37:02 jdbc[3]:
> > /*SQL */SET DB_CLOSE_ON_EXIT=FALSE;
> > 02-15 09:37:02 jdbc: COMMAND_CLOSE 70
> > 02-15 09:37:02 jdbc:
> > /**/stat5.getUpdateCount();
> > 02-15 09:37:02 jdbc:
> > /**/stat5.close();
> > ^C02-15 09:37:10 database: closing mem:test-db from shutdown hook
> > 02-15 09:37:10 database: disconnecting session #2
> > 02-15 09:37:10 database: disconnected session #2
> > 02-15 09:37:10 database: disconnecting session #3
> > 02-15 09:37:10 database: disconnected session #3
> > 02-15 09:37:10 database: closing mem:test-db
> > 02-15 09:37:10 database: closed
> > 02-15 09:37:10 jdbc:
> > /**/conn4.close();
> > 02-15 09:37:10 jdbc: SESSION_UNDO_LOG_POS 0
> > 02-15 09:37:10 jdbc: SESSION_CLOSE 0
> > 02-15 09:37:10 jdbc: close
> > java.io.IOException: org.h2.jdbc.JdbcSQLException: Connection is
> > broken: "session closed" [90067-164]
> >        at org.h2.message.DbException.getJdbcSQLException(DbException.java:
> > 329)
> >        at org.h2.message.DbException.get(DbException.java:169)
> >        at org.h2.message.DbException.get(DbException.java:146)
> >        at org.h2.engine.Session.prepareLocal(Session.java:400)
> >        at org.h2.server.TcpServerThread.closeSession(TcpServerThread.java:
> > 163)
> >        at org.h2.server.TcpServerThread.process(TcpServerThread.java:267)
> >        at org.h2.server.TcpServerThread.run(TcpServerThread.java:146)
> >        at java.lang.Thread.run(Thread.java:722)
>
> >        at org.h2.engine.SessionRemote.done(SessionRemote.java:568)
> >        at org.h2.engine.SessionRemote.close(SessionRemote.java:512)
> >        at org.h2.jdbc.JdbcConnection.close(JdbcConnection.java:365)
> >        at org.h2.server.web.WebSession.close(WebSession.java:252)
> >        at org.h2.server.web.WebServer.stop(WebServer.java:388)
> >        at org.h2.server.web.WebServlet.destroy(WebServlet.java:55)
> >        at
> > org.eclipse.jetty.servlet.ServletHolder.destroyInstance(ServletHolder.java:
> > 343)
> >        at org.eclipse.jetty.servlet.ServletHolder.doStop(ServletHolder.java:
> > 317)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.servlet.ServletHandler.doStop(ServletHandler.java:
> > 207)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
> > 102)
> >        at
> > org.eclipse.jetty.security.SecurityHandler.doStop(SecurityHandler.java:
> > 356)
> >        at
> > org.eclipse.jetty.security.ConstraintSecurityHandler.doStop(ConstraintSecur 
> > ityHandler.java:
> > 237)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
> > 102)
> >        at
> > org.eclipse.jetty.server.session.SessionHandler.doStop(SessionHandler.java:
> > 133)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
> > 102)
> >        at
> > org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:
> > 798)
> >        at
> > org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandle 
> > r.java:
> > 153)
> >        at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:
> > 478)
> >        at
> > org.mortbay.jetty.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:
> > 264)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection 
> > .java:
> > 245)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection 
> > .java:
> > 245)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
> > 102)
> >        at org.eclipse.jetty.server.Server.doStop(Server.java:324)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:
> > 124)
> > Caused by: org.h2.jdbc.JdbcSQLException: Connection is broken:
> > "session closed" [90067-164]
> >        at org.h2.message.DbException.getJdbcSQLException(DbException.java:
> > 329)
> >        at org.h2.message.DbException.get(DbException.java:169)
> >        at org.h2.message.DbException.get(DbException.java:146)
> >        at org.h2.engine.Session.prepareLocal(Session.java:400)
> >        at org.h2.server.TcpServerThread.closeSession(TcpServerThread.java:
> > 163)
> >        at org.h2.server.TcpServerThread.process(TcpServerThread.java:267)
> >        at org.h2.server.TcpServerThread.run(TcpServerThread.java:146)
> >        at java.lang.Thread.run(Thread.java:722)
>
> >        at org.h2.engine.SessionRemote.done(SessionRemote.java:565)
> >        ... 31 more
> > org.h2.jdbc.JdbcSQLException: Connection is broken: "session
> > closed" [90067-164]
> >        at org.h2.message.DbException.getJdbcSQLException(DbException.java:
> > 329)
> >        at org.h2.message.DbException.get(DbException.java:169)
> >        at org.h2.message.DbException.get(DbException.java:146)
> >        at org.h2.engine.SessionRemote.checkClosed(SessionRemote.java:500)
> >        at org.h2.engine.SessionRemote.removeServer(SessionRemote.java:431)
> >        at org.h2.command.CommandRemote.prepare(CommandRemote.java:80)
> >        at org.h2.command.CommandRemote.<init>(CommandRemote.java:46)
> >        at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:437)
> >        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:
> > 1121)
> >        at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:164)
> >        at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:152)
> >        at org.h2.server.web.DbStarter.contextDestroyed(DbStarter.java:74)
> >        at
> > org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:
> > 806)
> >        at
> > org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandle 
> > r.java:
> > 153)
> >        at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:
> > 478)
> >        at
> > org.mortbay.jetty.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:
> > 264)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection 
> > .java:
> > 245)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection 
> > .java:
> > 245)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:
> > 102)
> >        at org.eclipse.jetty.server.Server.doStop(Server.java:324)
> >        at
> > org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.j 
> > ava:
> > 84)
> >        at
> > org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:
> > 124)
> > 2012-02-15
> > 09:37:10.994:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver
> > purged
>
> > On Feb 15, 8:36 am, Noel Grandin <noelgran...@gmail.com> wrote:
> >> Your URL looks fine.
> >> Looks like a bug somewhere in H2 to me.
> >> But I don't know why the code is ignoring that setting.
>
> >> The only thing I can suggest is executing this command when your
> >> application starts up:
> >>    SET DB_CLOSE_ON_EXIT=FALSE
>
> >> On 2012-02-15 16:30, zaraki kenpachi wrote:
>
> >> > Here is what I'm using in persistence.xml:
> >> > <property name = "javax.persistence.jdbc.url" value = "jdbc:h2:tcp://
> >> > localhost/mem:test-db;create=true;DB_CLOSE_ON_EXIT=FALSE"/>
>
> >> > I'm pretty sure that is right, but did I miss something?
>
> >> > I'm using H2 1.3.164.
>
> >> > I can make a small demo maven/jetty/h2 project that displays the issue
> >> > if that would be helpful.
>
> >> > On Feb 15, 1:12 am, Noel Grandin<noelgran...@gmail.com>  wrote:
> >> >> Yes.
>
> >> >> That means that the DB_CLOSE_ON_EXIT=FALSE flag is not working. Are you
> >> >> sure you tested with that flag in place?
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to