Dubbo 2.6.5启动报java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup

Dubbo 2.6.5启动报java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup

错误信息如下:

22:39:42.357 [main] WARN  c.a.d.q.protocol.QosProtocolWrapper -  [DUBBO] Fail to start qos server: , dubbo version: 2.6.5, current host: 192.168.185.1
java.lang.NoClassDefFoundError: io/netty/channel/EventLoopGroup
	at com.alibaba.dubbo.qos.protocol.QosProtocolWrapper.startQosServer(QosProtocolWrapper.java:95) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:59) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:55) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:513) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:358) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:317) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:216) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.spring.ServiceBean.export(ServiceBean.java:291) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:131) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:53) [dubbo-2.6.5.jar:2.6.5]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
	at com.alibaba.dubbo.container.spring.SpringContainer.start(SpringContainer.java:50) [dubbo-2.6.5.jar:2.6.5]
	at com.alibaba.dubbo.container.Main.main(Main.java:86) [dubbo-2.6.5.jar:2.6.5]
	at ex.dubbo.book.start.StartDubboProvider.main(StartDubboProvider.java:12) [classes/:na]
Caused by: java.lang.ClassNotFoundException: io.netty.channel.EventLoopGroup
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_172]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_172]
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_172]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_172]
	... 21 common frames omitted

原因:缺少netty-all的jar包,在pom.xml中添加jar依赖即可,如下:

<dependency>
	<groupId>io.netty</groupId>
	<artifactId>netty-all</artifactId>
	<version>4.1.32.Final</version>
</dependency>

本文来源KeiKei.,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/25334

发表评论