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 See http://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 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.