Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2045

JdbcSQLException: "Database is already closed" on server shutdown

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 7.1.0.Beta1
    • 7.0.2.Final
    • JCA, JPA / Hibernate
    • None
    • Release Notes

    Description

      An application that uses the "create-drop" Hibernate ddl strategy fails do undeploy properly on shutdown when a persistent (non-in-memory) database is used. Shutdown log below.

      This issue is critical for the demo applications on openshift express (which uses persistent setup for the built-in database) where redeploy is expected to get the application to the default state.

      To reproduce:

      1. Use the attached standalone-persistent.xml profile (the only change is redefinition of the built-in datasource URL to jdbc:h2:${jboss.server.data.dir}/test;DB_CLOSE_DELAY=-1)
      2. Deploy the attached application
      3. Start the server with the persistent profile (./standalone.sh --server-config=../standalone/configuration/standalone-persistent.xml)
      4. Stop the server (Ctrl+C)
      5. You should see the exception below
      16:42:43,982 INFO  [org.jboss.as.logging] Restored bootstrap log handlers
      16:42:44,003 INFO  [org.jboss.jpa] stopping Persistence Unit Service 'test.war#booking' 
      16:42:44,005 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] HHH00227:Running hbm2ddl schema export
      16:42:44,014 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] HHH00231:Schema export unsuccessful: org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-145]
              at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
              at org.h2.message.DbException.get(DbException.java:167)
              at org.h2.message.DbException.get(DbException.java:144)
              at org.h2.message.DbException.get(DbException.java:133)
              at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1333)
              at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1308)
              at org.h2.jdbc.JdbcConnection.setAutoCommit(JdbcConnection.java:364)
              at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.checkTransaction(BaseWrapperManagedConnection.java:810)
              at org.jboss.jca.adapters.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:1567)
              at org.jboss.jca.adapters.jdbc.WrappedConnection.createStatement(WrappedConnection.java:295)
              at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:54)
              at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:354)
              at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:305)
              at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:301)
              at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:1288)
              at org.hibernate.ejb.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:126)
              at org.jboss.as.jpa.service.PersistenceUnitService.stop(PersistenceUnitService.java:88) [jboss-as-jpa-7.0.2.Final.jar:7.0.2.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StopTask.stopService(ServiceControllerImpl.java:1909) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
              at org.jboss.msc.service.ServiceControllerImpl$StopTask.run(ServiceControllerImpl.java:1872) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
      
      16:42:44,018 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] HHH00230:Schema export complete
      16:42:44,022 INFO  [com.arjuna.ats.jbossatx] ARJUNA32018: Destroying TransactionManagerService
      16:42:44,028 INFO  [com.arjuna.ats.jbossatx] ARJUNA32014: Stopping transaction recovery manager
      16:42:44,030 INFO  [org.jboss.as.server.deployment] Stopped deployment test.war in 68ms
      16:42:44,032 INFO  [org.jboss.as] JBoss AS 7.0.2.Final "Arc" stopped in 66ms
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rhn-engineering-jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: