项目

一般

简介

h2数据库异常

邱 京宽3 个月 之前添加

2024-09-25 09:33:36,387 ERROR [main] o.s.b.SpringApplication [SpringApplication.java : 839] Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.admq.manager.DatabaseInitializer' defined in URL [jar:file:/app/admq-manager-V2.4.12/lib/admq-starter-2.4.12.jar!/com/admq/manager/DatabaseInitializer.class]: PreparedStatementCallback; SQL [SELECT COUNT(*) FROM INFORMATION_SCHEMA.INDEXES WHERE table_name = ? AND index_name = ?]; The database has been closed [90098-224]

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1775)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)

    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)

    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)

    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)

    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:946)

    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616)

    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)

    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753)

    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455)

    at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)

    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342)

    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331)

    at com.admq.manager.ADMQManagerApplication.main(ADMQManagerApplication.java:55)

Caused by: org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback; SQL [SELECT COUNT(*) FROM INFORMATION_SCHEMA.INDEXES WHERE table_name = ? AND index_name = ?]; The database has been closed [90098-224]

    at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:88)

    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:107)

    at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1548)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:677)

    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:723)

    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:754)

    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:767)

    at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:889)

    at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:916)

    at com.admq.manager.dbInitializer.initializer.H2Initializer.lambda$initIndex$0(H2Initializer.java:26)

    at java.base/java.lang.Iterable.forEach(Iterable.java:75)

    at com.admq.manager.dbInitializer.initializer.H2Initializer.initIndex(H2Initializer.java:21)

    at com.admq.manager.dbInitializer.DataSourceInitializer.init(DataSourceInitializer.java:10)

    at com.admq.manager.DatabaseInitializer.afterPropertiesSet(DatabaseInitializer.java:28)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1822)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1771)

    ... 16 common frames omitted

Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: The database has been closed [90098-224]

    at org.h2.message.DbException.getJdbcSQLException(DbException.java:690)

    at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)

    at org.h2.message.DbException.get(DbException.java:212)

    at org.h2.engine.SessionLocal.getTransaction(SessionLocal.java:1610)

    at org.h2.engine.SessionLocal.startStatementWithinTransaction(SessionLocal.java:1631)

    at org.h2.command.Command.executeQuery(Command.java:186)

    at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:131)

    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)

    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)

    at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:732)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)

    ... 28 common frames omitted

Caused by: org.h2.mvstore.MVStoreException: Invalid chunk id 0 [2.2.224/6]

    at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)

    at org.h2.mvstore.Chunk.<init>(Chunk.java:210)

    at org.h2.mvstore.SFChunk.<init>(SFChunk.java:22)

    at org.h2.mvstore.RandomAccessStore.createChunk(RandomAccessStore.java:54)

    at org.h2.mvstore.RandomAccessStore.createChunk(RandomAccessStore.java:28)

    at org.h2.mvstore.FileStore.createChunk(FileStore.java:764)

    at org.h2.mvstore.FileStore.serializeAndStore(FileStore.java:1423)

    at org.h2.mvstore.FileStore.lambda$storeIt$2(FileStore.java:1376)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

    at java.base/java.lang.Thread.run(Thread.java:833)

 

 

解决方案,

更新H2是数据库版本,既更新lib下的h2数据库的jar包