ERROR - SchemaExport.execute(287) |2017-03-18 11:15:35,416| 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-135]
I thought this could be related to the Spring version but it also fails the same way when running against Core 2.0.x. I added a new Maven build profile ‘openmrs-2.0’ for this, should you need to try stuff against Core 2.x (mvn -P openmrs-2.0 clean install).
Would you mind running a mvn clean install on your side? You can clone commit 86755eb2 from our fork to reproduce it.
I just don’t know yet enough of all the plumbing behind context sensitive tests to take action here. Where is the DB URL defined for the unit tests for instance, or how to overwrite it as suggested in the error message?
@mksd, I’m not seeing that error in the full stack trace you provided. I do this this line in there, if it helps:
ERROR - AddressHierarchyServiceImpl.getPossibleAddressValues(82) |2017-03-18 12:02:45,362| Address field ADDRESS_1 is not mapped to address hierarchy level.
ERROR - SchemaExport.execute(287) |2017-03-18 12:02:50,801| 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-135]
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:1348)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1323)
at org.h2.jdbc.JdbcConnection.getAutoCommit(JdbcConnection.java:386)
at com.mchange.v2.c3p0.impl.NewProxyConnection.getAutoCommit(NewProxyConnection.java:985)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:82)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:263)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:229)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:961)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:251)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.destroy(LocalSessionFactoryBean.java:899)
at org.openmrs.api.db.hibernate.HibernateSessionFactoryBean.destroy(HibernateSessionFactoryBean.java:196)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:184)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:487)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:463)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:431)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1048)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1022)
at org.springframework.context.support.AbstractApplicationContext$3.run(AbstractApplicationContext.java:940)
The database exception is just a side effect of another failure which is the real cause. That is: NoSuchBeanDefinitionException: No matching bean of type [org.openmrs.ui.framework.UiUtils] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
Since UiUtils is not a spring bean itself, you would need a spring bean that sub classes it for such to work.
Regardless of the solution of getting this to work, I don’t actually think wiring in UiUtils is the right solution to this problem. As I think @mogoodrich replied in the other thread - we don’t need to depend on the uiframework in order to support localization:
Translation support is already in the API, it is not limited to the Web (I’m not sure if this was your concern @rubailly, but there is nothing wrong with doing translations in the API project). It may be that UiUtils adds some functionality around this, but this should be simple to reproduce.
As far as I know, addresshierarchy does not depend on uiframework or related modules. It would be better to keep it that way, if possible.
Hello , Am working on this ticket ,After cloning metadatasharing module, i encountered error logs here which is in the same thread, but unfortunately it seems the correct solution was not clear to me. Am still not in better position to check out how h2 database was defined in MDS module cc @mksd@dkayiwa@mseaton
Am facing the same error logs but this time round, am running metadata sharing module. Tried to make some changes by configuring the h2 database but the same error pops up. how did you came along this thanks cc @mksd
Sorry, but i went ahead and cloned openmrs-module-metadatasharing module from git, and run mvn clean install. without any new commits then i encountered the same logs thanks
Ok I see, you see this on a couple of Spring tests:
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-135]
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:1348)
at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1323)
at org.h2.jdbc.JdbcConnection.getAutoCommit(JdbcConnection.java:386)
at com.mchange.v2.c3p0.impl.NewProxyConnection.getAutoCommit(NewProxyConnection.java:985)
at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:82)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:263)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:229)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:961)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.destroy(AbstractSessionFactoryBean.java:251)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.destroy(LocalSessionFactoryBean.java:899)
at org.openmrs.api.db.hibernate.HibernateSessionFactoryBean.destroy(HibernateSessionFactoryBean.java:192)
But the overall build is not failing.
You can try what is suggested:
to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL
Here is an example from elsewhere (credits to @long27km):