MyCATApache / Mycat-Server

GNU General Public License v2.0
9.5k stars 3.85k forks source link

sh init_zk_data.sh 报错ERROR Unable to register shutdown hook because JVM is shutting down #2569

Open ouminAsk opened 4 years ago

ouminAsk commented 4 years ago

jdk版本: 1.8 zookeeper 版本: zookeeper-3.4.14 mycat 版本: Mycat-server-1.6.5-release-20180122220033-linux.tar.gz

 sh init_zk_data.sh 

o2020-08-06 18:44:45 INFO JAVA_CMD=java
o2020-08-06 18:44:45 INFO Start to initialize /mycat of ZooKeeper
2020-08-06 18:44:46,389 Thread-1 ERROR Unable to register shutdown hook because JVM is shutting down. java.lang.IllegalStateException: Cannot add new shutdown hook as this is not started. Current state: STOPPED
    at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.addShutdownCallback(DefaultShutdownCallbackRegistry.java:113)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.addShutdownCallback(Log4jContextFactory.java:273)
    at org.apache.logging.log4j.core.LoggerContext.setUpShutdownHook(LoggerContext.java:256)
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:216)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:145)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
    at org.apache.logging.log4j.LogManager.getContext(LogManager.java:182)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:103)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
    at org.apache.curator.utils.CloseableUtils.<clinit>(CloseableUtils.java:33)
    at org.apache.curator.ConnectionState.close(ConnectionState.java:111)
    at org.apache.curator.CuratorZookeeperClient.close(CuratorZookeeperClient.java:203)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.close(CuratorFrameworkImpl.java:321)
    at io.mycat.util.ZKUtils$1.run(ZKUtils.java:31)
    at java.lang.Thread.run(Thread.java:748)

o2020-08-06 18:44:46 INFO Done

通过zookeeper查看配置信息已经加载到了,就是这里报错了。 谢谢开发者

funnyAnt commented 4 years ago

自己调试一把看看,然后提交一个PR。 看报错是shutdown的钩子回调报错了。

zhaozw1984 commented 3 years ago

这个问题解决没? mycat 版本: Mycat-server-1.6.7.6 也遇到这问题 反而我用Mycat-server-1.6.5是好的,但是这个版本schema.xml配置有个问题,table中subTables无法保存到zk。

mawen12 commented 2 years ago

这个问题可以通过禁用 shutdown hook 来解决。 在 mycat/conf/log4j2.xml 文件中增加以下内容:

<Configuration shutdownHook="disable" ...>

测试的版本为:Mycat-server-1.6.7.4 文件已经修改,并提交了PR。#2876