Spring Boot Webflux项目启动错误:NoClassDefFoundError: io/netty/channel/ChannelDuplexHandler

本文记录了将传统Web项目转换为WebFlux项目过程中遇到的启动失败问题及解决方法,重点在于调整Spring Boot版本。

今天把之前写好的web项目改成webflux项目,启动不起来,报错:

NoClassDefFoundError: io/netty/channel/ChannelDuplexHandler

对于原web项目我只把pom中对web的依赖改为webflux,然后把服务中的返回值改为mono或flux类型的,还要删除application.yml中的server.servlet.context-path:

按照过去的经历,这样是可行的,可是说什么也启动不起来,我又去start.spring.io新建了一个依赖reactive web的项目:

看了看pom依赖没有区别,直接运行竟然还是报一样的错,匪夷所思的我打开了过去的webflux项目,对比pom文件发现原来是parent版本出了问题,原来的可以运行的项目是2.0.3,而后来的是2.0.4,改成2.0.3之后可以运行。(改完后要右键工程名->Maven->Update Project)

特此记录一下,希望有助于和我一样懵懂的小白。

java.lang.NoClassDefFoundError: Could not initialize class io.netty.util.internal.PlatformDependent0 at io.netty.util.internal.PlatformDependent.getSystemClassLoader(PlatformDependent.java:694) at io.netty.channel.nio.NioEventLoop$4.run(NioEventLoop.java:171) at java.base/java.security.AccessController.doPrivileged(AccessController.java:319) at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:167) at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:149) at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:102) at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64) at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:70) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:65) at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:56) at org.apache.rocketmq.remoting.netty.NettyRemotingClient.<init>(NettyRemotingClient.java:122) at org.apache.rocketmq.client.impl.MQClientAPIImpl.<init>(MQClientAPIImpl.java:188) at org.apache.rocketmq.client.impl.factory.MQClientInstance.<init>(MQClientInstance.java:133) at org.apache.rocketmq.client.impl.MQClientManager.getOrCreateMQClientInstance(MQClientManager.java:53) at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.start(DefaultMQAdminExtImpl.java:120) at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.start(DefaultMQAdminExt.java:145) at org.apache.rocketmq.dashboard.admin.MQAdminFactory.getInstance(MQAdminFactory.java:53) at org.apache.rocketmq.dashboard.admin.MQAdminPooledObjectFactory.makeObject(MQAdminPooledObjectFactory.java:35) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObject
03-12
2025-08-19 13:38:50.348 WARN [] [main] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seataBeanPostProcessor' defined in class path resource [com/alibaba/cloud/seata/feign/SeataFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/genew/ems/common/exception/NuMaxCloudCommonException 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] i.seata.core.rpc.netty.AbstractNettyRemotingClient - channel inactive: [id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091] 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] io.seata.core.rpc.netty.NettyClientChannelManager - return to pool, rm channel:[id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091] 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] io.seata.core.rpc.netty.NettyPoolableFactory - channel valid false,channel:[id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091] 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] io.seata.core.rpc.netty.NettyPoolableFactory - will destroy channel:[id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091] 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] i.seata.core.rpc.netty.AbstractNettyRemotingClient - ChannelHandlerContext(AbstractNettyRemotingClient$ClientHandler#0, [id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091]) will closed 2025-08-19 13:38:50.349 INFO [] [NettyClientSelector_TMROLE_1_1] i.seata.core.rpc.netty.AbstractNettyRemotingClient - ChannelHandlerContext(AbstractNettyRemotingClient$ClientHandler#0, [id: 0xf919cf8d, L:/10.101.58.7:51928 ! R:/10.101.58.7:8091]) will closed 2025-08-19 13:38:50.361 INFO [] [main] o.s.b.a.l.ConditionEvaluationReportLoggingListener - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-08-19 13:38:50.365 ERROR [] [main] org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seataBeanPostProcessor' defined in class path resource [com/alibaba/cloud/seata/feign/SeataFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/genew/ems/common/exception/NuMaxCloudCommonException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:511) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) 为什么
最新发布
08-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值