Project

General

Profile

bug #9214

It is not possible to create a new schema in h2 database

Added by Katja Luther 15 days ago. Updated 11 days ago.

Status:
New
Priority:
New
Category:
cdmlib
Target version:
Start date:
09/03/2020
Due date:
% Done:

0%

Severity:
normal
Found in Version:

Description

Trying to create a schema in an emtpy h2 database results in an exception:

client error time : 2020-09-03T08:55:55.482
login : 
editor version : 5.17.0
server :  ()
schema version : 
os : Windows 7 6.1 amd64
java : 1.8.0_171
java.lang.RuntimeException: Error during CDM server startup
                at eu.etaxonomy.taxeditor.webapp.CdmServer$1.run(CdmServer.java:216)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentTermInitializer': Invocation of init method failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
                at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
                at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
                at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
                at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
                at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:930)
                at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
                at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:889)
                at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
                at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
                at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
                at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:822)
                at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
                at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
                at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
                at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
                at org.eclipse.jetty.server.Server.start(Server.java:407)
                at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
                at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
                at org.eclipse.jetty.server.Server.doStart(Server.java:371)
                at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
                at eu.etaxonomy.taxeditor.webapp.CdmServer$1.run(CdmServer.java:196)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
                at org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:541)
                at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
                at eu.etaxonomy.cdm.database.PersistentTermInitializer.doInitialize(PersistentTermInitializer.java:109)
                at eu.etaxonomy.cdm.model.term.DefaultTermInitializer.initialize(DefaultTermInitializer.java:37)
                at eu.etaxonomy.cdm.database.PersistentTermInitializer.initialize(PersistentTermInitializer.java:92)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354)
                at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305)
                at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
                ... 31 more
Caused by: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
                at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
                at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
                at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
                at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:90)
                at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:112)
                at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getConnectionForTransactionManagement(LogicalConnectionManagedImpl.java:230)
                at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.begin(LogicalConnectionManagedImpl.java:237)
                at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.begin(JdbcResourceLocalTransactionCoordinatorImpl.java:214)
                at org.hibernate.engine.transaction.internal.TransactionImpl.begin(TransactionImpl.java:52)
                at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1512)
                at org.springframework.orm.hibernate5.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:499)
                ... 42 more
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
                at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
                at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:692)
                at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
                at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
                at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386)
                at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:87)
                ... 49 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
                at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1469)
                at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)
                at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)
                at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)
                at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
                ... 53 more
Caused by: org.h2.jdbc.JdbcSQLException: Datenbank wird wahrscheinlich bereits benutzt: null. Mögliche Lösungen: alle Verbindungen schliessen; Server Modus verwenden
Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-190]
                at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
                at org.h2.message.DbException.get(DbException.java:168)
                at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:187)
                at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:167)
                at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:99)
                at org.h2.engine.Database.getPageStore(Database.java:2450)
                at org.h2.engine.Database.open(Database.java:672)
                at org.h2.engine.Database.openDatabase(Database.java:269)
                at org.h2.engine.Database.<init>(Database.java:263)
                at org.h2.engine.Engine.openSession(Engine.java:65)
                at org.h2.engine.Engine.openSession(Engine.java:175)
                at org.h2.engine.Engine.createSessionAndValidate(Engine.java:153)
                at org.h2.engine.Engine.createSession(Engine.java:136)
                at org.h2.engine.Engine.createSession(Engine.java:28)
                at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:349)
                at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:107)
                at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:91)
                at org.h2.Driver.connect(Driver.java:72)
                at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
                at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
                at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
                at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
                at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
                at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
                at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
                at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
                at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Caused by: java.lang.IllegalStateException: The file is locked: nio:C:/Users/k.luther/.cdmLibrary/writableResources/h2/LocalH2/cdm.mv.db [1.4.190/7]
                at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:773)
                at org.h2.mvstore.FileStore.open(FileStore.java:167)
                at org.h2.mvstore.MVStore.<init>(MVStore.java:342)
                at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2888)
                at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:154)
                ... 23 more
Caused by: java.nio.channels.OverlappingFileLockException
                at sun.nio.ch.SharedFileLockTable.checkList(Unknown Source)
                at sun.nio.ch.SharedFileLockTable.add(Unknown Source)
                at sun.nio.ch.FileChannelImpl.tryLock(Unknown Source)
                at org.h2.store.fs.FileNio.tryLock(FilePathNio.java:121)
                at org.h2.mvstore.cache.FilePathCache$FileCache.tryLock(FilePathCache.java:158)
                at java.nio.channels.FileChannel.tryLock(Unknown Source)
                at org.h2.mvstore.FileStore.open(FileStore.java:164)
                ... 26 more

History

#1 Updated by Andreas Kohlbecker 11 days ago

  • Status changed from New to Feedback
  • Assignee changed from Andreas Müller to Katja Luther

From reading the stack trace it seems as if you attempted to create the db from within the taxeditor datasources view. Is this assumption correct?

#2 Updated by Andreas Müller 11 days ago

Andreas Kohlbecker wrote:

From reading the stack trace it seems as if you attempted to create the db from within the taxeditor datasources view. Is this assumption correct?

How the database is created is not an issue here. It always created automatically if it does not exists yet. The problem seems is the schema check which is done in a different class loader context (taxeditor) then the schema create (remote-webapp).

#3 Updated by Andreas Müller 11 days ago

  • Status changed from Feedback to New
  • Assignee changed from Katja Luther to Andreas Müller
  • Target version changed from Unassigned CDM tickets to Release 5.18

#4 Updated by Katja Luther 11 days ago

Andreas Kohlbecker wrote:

From reading the stack trace it seems as if you attempted to create the db from within the taxeditor datasources view. Is this assumption correct?

No, I tried to create a new schema from the login dialog for a managed server connection. But I think the dialog opened a connection already for checking whether a schema exists.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)