cssxsh / mirai-hibernate-plugin

Mirai Console Hibernate/ORM 数据库前置插件
GNU Affero General Public License v3.0
31 stars 1 forks source link

Unable to create requested service 该怎么解决呀 #13

Closed R1nkwh closed 1 year ago

R1nkwh commented 1 year ago
2022-12-15 18:30:34 E/mirai-hibernate-plugin: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:267)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:230)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.model.relational.Database.<init>(Database.java:44)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.getDatabase(InFlightMetadataCollectorImpl.java:218)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:191)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:138)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:97)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:402)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:90)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:735)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:773)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar//xyz.cssxsh.mirai.hibernate.MiraiHibernatePlugin.onEnable(MiraiHibernatePlugin.kt:50)
        at net.mamoe.mirai.console.internal.plugin.JvmPluginInternal.internalOnEnable$mirai_console(JvmPluginInternal.kt:131)
        at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:305)
        at net.mamoe.mirai.console.internal.plugin.BuiltInJvmPluginLoaderImpl.enable(BuiltInJvmPluginLoaderImpl.kt:35)
        at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt)
        at net.mamoe.mirai.console.plugin.jvm.JvmPluginLoader$BuiltIn.enable(JvmPluginLoader.kt:50)
        at net.mamoe.mirai.console.plugin.PluginManager.enablePlugin(PluginManager.kt:173)
        at net.mamoe.mirai.console.internal.plugin.PluginManagerImpl.enableAllLoadedPlugins$mirai_console(PluginManagerImpl.kt:175)
        at net.mamoe.mirai.console.internal.MiraiConsoleImplementationBridge.doStart$mirai_console(MiraiConsoleImplementationBridge.kt:336)
        at net.mamoe.mirai.console.MiraiConsoleImplementation$Companion.start(MiraiConsoleImplementation.kt:508)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon(MiraiConsoleTerminalLoader.kt:177)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.startAsDaemon$default(MiraiConsoleTerminalLoader.kt:176)
        at net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader.main(MiraiConsoleTerminalLoader.kt:54)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.itxtech.mcl.Utility.bootJars(Utility.java:86)
        at org.itxtech.mcl.Utility.bootJars(Utility.java:76)
        at org.itxtech.mcl.Utility.bootMirai(Utility.java:98)
        at org.itxtech.mcl.module.builtin.Boot.boot(Boot.java:113)
        at org.itxtech.mcl.module.ModuleManager.phaseBoot(ModuleManager.java:123)
        at org.itxtech.mcl.Loader.lambda$start$4(Loader.java:196)
        at org.itxtech.mcl.Loader.tryCatching(Loader.java:151)
        at org.itxtech.mcl.Loader.start(Loader.java:196)
        at org.itxtech.mcl.Loader.main(Loader.java:84)
Caused by: org.hibernate.HibernateException: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Database may be already in use: "/root/data/xyz.cssxsh.mirai.plugin.mirai-hibernate-plugin/hibernate.h2.mv.db". Possible solutions: close all other connection(s); use the server mode [90020-214]
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.hikaricp.internal.HikariCPConnectionProvider.configure(HikariCPConnectionProvider.java:62)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:125)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:239)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:249)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:175)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:36)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:119)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:255)
        ... 37 more
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Database may be already in use: "/root/data/xyz.cssxsh.mirai.plugin.mirai-hibernate-plugin/hibernate.h2.mv.db". Possible solutions: close all other connection(s); use the server mode [90020-214]
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.hibernate.hikaricp.internal.HikariCPConnectionProvider.configure(HikariCPConnectionProvider.java:58)
        ... 45 more
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already in use: "/root/data/xyz.cssxsh.mirai.plugin.mirai-hibernate-plugin/hibernate.h2.mv.db". Possible solutions: close all other connection(s); use the server mode [90020-214]
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.message.DbException.getJdbcSQLException(DbException.java:678)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.message.DbException.get(DbException.java:212)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.db.Store.convertMVStoreException(Store.java:168)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.db.Store.<init>(Store.java:145)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.engine.Database.<init>(Database.java:324)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.engine.Engine.openSession(Engine.java:92)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.engine.Engine.openSession(Engine.java:222)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.engine.Engine.createSession(Engine.java:201)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.Driver.connect(Driver.java:59)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
        ... 48 more
Caused by: org.h2.mvstore.MVStoreException: The file is locked: /root/data/xyz.cssxsh.mirai.plugin.mirai-hibernate-plugin/hibernate.h2.mv.db [2.1.214/7]
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.FileStore.open(FileStore.java:178)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.FileStore.open(FileStore.java:128)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.MVStore.<init>(MVStore.java:452)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.MVStore$Builder.open(MVStore.java:4082)
        at mirai-hibernate-plugin-2.5.1.mirai2.jar[shared]//org.h2.mvstore.db.Store.<init>(Store.java:136)
        ... 60 more
cssxsh commented 1 year ago

Caused by: org.h2.mvstore.MVStoreException: The file is locked: /root/data/xyz.cssxsh.mirai.plugin.mirai-hibernate-plugin/hibernate.h2.mv.db [2.1.214/7]

请检查是否启动了多个 mirai-console 实例,导致占用了同一个数据库文件 或者不正常关闭 mirai-console 导致文件没有正常解锁

R1nkwh commented 1 year ago

重启了服务器,正常了