本文主要是介绍java.sql.SQLException: Failed to start database ‘metastore_db‘ with class loader sun.misc.Launcher$A,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
详细报错信息如下:
2021-12-19T19:20:16,310 ERROR [cbeeba86-79bb-4066-8f66-3997efd02277 main] pool.HikariPool: HikariPool-1 - Exception during pool initialization.
java.sql.SQLException: Failed to start database 'metastore_db' with class loader sun.misc.Launcher$AppClassLoader@2c8d66b2, see the next exception for details.at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.jdbc.InternalDriver$LoginCallable.call(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.jdbc.InternalDriver$LoginCallable.call(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_212]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_212]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_212]at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: org.apache.derby.iapi.error.StandardException: Failed to start database 'metastore_db' with class loader sun.misc.Launcher$AppClassLoader@2c8d66b2, see the next exception for details.at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) ~[derby-10.14.1.0.jar:?]... 15 more
Caused by: org.apache.derby.iapi.error.StandardException: Another instance of Derby may have already booted the database /home/lqs/module/hive/metastore_db.at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.privGetJBMSLockOnDB(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.getJBMSLockOnDB(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.raw.data.BaseDataFileFactory.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.raw.RawStore$6.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]at org.apache.derby.impl.store.raw.RawStore.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.access.RAMAccessManager$5.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]at org.apache.derby.impl.store.access.RAMAccessManager.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.db.BasicDatabase$5.run(Unknown Source) ~[derby-10.14.1.0.jar:?]at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]at org.apache.derby.impl.db.BasicDatabase.bootServiceModule(Unknown Source) ~[derby-10.14.1.0.jar:?]at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source) ~[derby-10.14.1.0.jar:?]
原因如下:
Hive默认使用的元数据库为derby,开启Hive之后就会占用元数据库,且不与其他客户端共享数据,所以我们需要将Hive的元数据地址改为MySQL。
#解决办法:
1、在Hive的安装目录下将derby.log和metastore_db删除,顺便将hdfs上目录删除
[lqs@bdc112 hive]$ rm -rf derby.log metastore_db
[lqs@bdc112 hive]$ hadoop fs -rm -r /user
这篇关于java.sql.SQLException: Failed to start database ‘metastore_db‘ with class loader sun.misc.Launcher$A的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!