spring boot + dubbo开发遇到过的异常

  1. 异常信息
    NoClassDefFoundErrororg.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1162)
Session 0x35e929e94120196 for server 172.16.0.239/172.16.0.239:2182, unexpected error, closing socket connection and attempting reconnect

NoClassDefFoundError
org/apache/zookeeper/proto/SetWatches
org.apache.zookeeper.ClientCnxn$SendThread in primeConnection at line 926
org.apache.zookeeper.ClientCnxnSocketNIO in doTransport at line 363
org.apache.zookeeper.ClientCnxn$SendThread in run at line 1141

NoClassDefFoundErrororg.jboss.netty.logging.JdkLogger.warn(JdkLogger.java:86)

NoClassDefFoundError
org/jboss/netty/channel/DefaultExceptionEvent
org.jboss.netty.channel.Channels in fireExceptionCaught at line 432
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss in connect at line 390
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss in processSelectedKeys at line 354
org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss in run at line 276
java.util.concurrent.ThreadPoolExecutor in runWorker at line 1142
java.util.concurrent.ThreadPoolExecutor$Worker in run at line 617
java.lang.Thread in run at line 748
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
	at java.net 

.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

  1. 原因分析
    image

现在感觉这些异常的产生都跟dubbo相关线程没有得到很好的关闭导致的。

  1. 解决方案
启动时增加系统属性参数:-Ddubbo.shutdown.hook=true
比如这样:
java -Ddubbo.shutdown.hook=true -jar pms-wx-1.0.0-SNAPSHOT.jar --spring.profiles.active=qc --spring.dubbo.registry.group=dubbo-test

参考资料

posted on 2017-10-24 15:54  James.H.Fu  阅读(3337)  评论(0编辑  收藏  举报

导航