This is the results when I start the web application, run some unit
tests, clear the terminal and then do a "mvn jetty:stop"
Is that what you wanted to see?
Killing Jetty
02-14 08:29:37 database: closing mem:test-db from shutdown hook
02-14 08:29:37 database: disconnecting session #2
02-14 08:29:37 database: disconnected session #2
02-14 08:29:37 database: disconnecting session #3
02-14 08:29:37 database: disconnected session #3
02-14 08:29:37 database: closing mem:test-db
02-14 08:29:37 database: closed
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(ServletContextHandler.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.java:
84)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:
245)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
84)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:
245)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:
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.java:
84)
at
org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:
124)
On Feb 14, 8:05 am, Noel Grandin <[email protected]> wrote:
> My best guess would be one of two things
> (1) something is closing the connection obtained from
> DbStarter#getConnection, which is a no-no
> or
> (2) Jetty is calling DbStarter#contextDestroyed more than once, which
> isn't great, but we should ideally be tolerant of that.
>
> Can you turn on the trace and see what is
> happening?http://www.h2database.com/html/features.html#trace_options
>
> On 2012-02-14 15:58, zaraki kenpachi wrote:
>
>
>
>
>
>
>
> > Thanks for the reply. I tried that as shown below and I still get the
> > stack track.
>
> > jdbc:h2:tcp://localhost/mem:test-db;create=true;DB_CLOSE_ON_EXIT=FALSE
>
> > I don't know if I mentioned before that I'm using EclipseLink. I'm not
> > sure if that is relevant or not.
>
> > Here is the full stack trace in case it is helpful:
>
> > ^Corg.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-14
> > 07:51:35.671:INFO:oejsl.ELContextCleaner:javax.el.BeanELResolver
> > purged
> > 2012-02-14 07:51:35.671:INFO:oejsh.ContextHandler:stopped
> > o.m.j.p.JettyWebAppContext{/test,file:/Users/zaraki/tmp/test-tmp/test-
> > db/src/main/webapp/},file:/Users/zaraki/tmp/test-tmp/test-db/src/main/
> > webapp/
> > [INFO] Jetty server exiting.
> > On Feb 14, 1:29 am, Noel Grandin<[email protected]> wrote:
> >> sounds like the Jetty exit handler is running after the H2 exit handler.
> >> Try adding this to the JDBC URL
>
> >> ;DB_CLOSE_ON_EXIT=FALSE
>
> >> Seehttp://www.h2database.com/html/features.html#connection_modes
>
> >> On 2012-02-14 05:07, zaraki kenpachi wrote:
>
> >>> I am running an in memory database using the servlet for a testing
> >>> environment. The db disappears when the jvm goes away. This works
> >>> great for our testing. We use Maven and a simple mvn jetty:run will
> >>> bring up the web app, the db, and the web based console.
> >>> The problem comes when shutting down. If I stop Jetty with mvn
> >>> jetty:stop or by just doing a control+c I get the following error:
> >>> Killing Jetty
> >>> 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)
> >>> ..... etc......
> >>> It almost seems like org.h2.server.web.DbStarter is trying to shutdown
> >>> the db server, but finding that the db already shut down on its own
> >>> when it saw the jvm going away. I've fiddled with a bunch of the
> >>> settings in web.xml, but haven't been able to avoid this error. It all
> >>> seems to work ok, but some of the team members are freaking out at the
> >>> stack trace.
> >>> Any suggestions? My settings are shown below.
> >>> The url is: jdbc:h2:tcp://localhost/mem:test-db;create=true
> >>> web.xml includes:
> >>> <listener>
> >>> <listener-class>org.h2.server.web.DbStarter</listener-class>
> >>> </listener>
> >>> <context-param>
> >>> <param-name>db.url</param-name>
> >>> <param-value>jdbc:h2:tcp://localhost/mem:test-db;create=true</
> >>> param-value>
> >>> </context-param>
> >>> <context-param>
> >>> <param-name>db.user</param-name>
> >>> <param-value>sa</param-value>
> >>> </context-param>
> >>> <context-param>
> >>> <param-name>db.password</param-name>
> >>> <param-value>sa</param-value>
> >>> </context-param>
> >>> <context-param>
> >>> <param-name>db.tcpServer</param-name>
> >>> <param-value>-tcpAllowOthers</param-value>
> >>> </context-param>
> >>> <servlet>
> >>> <servlet-name>H2Console</servlet-name>
> >>> <servlet-class>org.h2.server.web.WebServlet</servlet-class>
> >>> <load-on-startup>1</load-on-startup>
> >>> </servlet>
> >>> <servlet-mapping>
> >>> <servlet-name>H2Console</servlet-name>
> >>> <url-pattern>/console/*</url-pattern>
> >>> </servlet-mapping>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.