冲突的地放其实很多,大概都是类似,找不到哪个方法了:
类似于:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
19/07/02 16:07:02 ERROR boot.SpringApplication: Application run failed
java.lang.NoSuchMethodError: io.netty.util.concurrent.MultithreadEventExecutorGroup.(ILjava/util/concurrent/Executor;[Ljava/lang/Object;)V
at io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:52)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:87)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:82)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:63)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:51)
at io.netty.channel.nio.NioEventLoopGroup.(NioEventLoopGroup.java:43)
at com.ime.gbt32960.InfoServerApplication.run(InfoServerApplication.java:33)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:797)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:781)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.ime.gbt32960.InfoServerApplication.main(InfoServerApplication.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
其实发生这种事情,靠猜没用的。最简单粗暴的方式就是通过maven打印依赖树的方式,去查看;
比如上面的错误,是因为netty版本不一致造成的。那么就打印依赖树,找到所有netty。然后去掉不是你导入的版本就行了(因为应用的框架多了,内部通信啥的,很多都会选择netty,这就导致你的版本不一定与内部框架的netty版本一致的原因);
查看maven的依赖树方法:
mvn dependency:tree
然后搜索netty。就可以看到版本不一致是哪个框架的
如果知道了是哪个框架的,那么使用maven的排除,即可:
例如:
org.apache.hadoop
hadoop-common
${hadoop.version}-${cdh.version}
com.google.code.gson
gson
org.jboss.netty
netty
io.netty
netty
io.netty
netty-all
Original: https://www.cnblogs.com/niutao/articles/11121473.html
Author: niutao
Title: 记一次关于springboot的netty版本冲突问题
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/541840/
转载文章受原作者版权保护。转载请注明原作者出处!