> 文章列表 > DnsAddressResolverGroupFactory.create(DnsAddressResolverGroupFactory.java:33)

DnsAddressResolverGroupFactory.create(DnsAddressResolverGroupFactory.java:33)

DnsAddressResolverGroupFactory.create(DnsAddressResolverGroupFactory.java:33)

今天处理了一个dubb升级造成的包冲突,记录下,希望能帮到一些有同样问题的小伙伴,并且将自己解决包冲突的想法总结下

背景:

因为dubbo出现安全漏洞,公司的安全组要求将dubbo的版本由2.7.3-SNAPSHOT 升级到 2.7.3.7-RELEASE

问题:

因为是依赖的组件中引用了低版本的dubbo,所以想着在该组件中使用 exclusions的方式排除掉,然后引入最近版本的dubbo,一顿操作之后没想到报了一个错如下,然后就开始我的排错之旅

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-04-19 16:05:49.219  INFO 19451 --- [  restartedMain] .b.c.e.AwaitingNonWebApplicationListener :  [Dubbo] Current Spring Boot Application is about to shutdown...
2023-04-19 16:05:49.228 ERROR 19451 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : ***************************
APPLICATION FAILED TO START
***************************Description:An attempt was made to call a method that does not exist. The attempt was made from the following location:org.redisson.connection.DnsAddressResolverGroupFactory.create(DnsAddressResolverGroupFactory.java:33)The following method did not exist:io.netty.resolver.dns.DnsAddressResolverGroup.<init>(Ljava/lang/Class;Lio/netty/resolver/dns/DnsServerAddressStreamProvider;)VThe method's class, io.netty.resolver.dns.DnsAddressResolverGroup, is available from the following locations:jar:file:/Users/zhangruibiao/Downloads/maven_repo/org/asynchttpclient/netty-resolver-dns/2.0.36/netty-resolver-dns-2.0.36.jar!/io/netty/resolver/dns/DnsAddressResolverGroup.classjar:file:/Users/zhangruibiao/Downloads/maven_repo/io/netty/netty-all/4.1.43.Final/netty-all-4.1.43.Final.jar!/io/netty/resolver/dns/DnsAddressResolverGroup.classjar:file:/Users/zhangruibiao/Downloads/maven_repo/io/netty/netty-resolver-dns/4.1.43.Final/netty-resolver-dns-4.1.43.Final.jar!/io/netty/resolver/dns/DnsAddressResolverGroup.classIt was loaded from the following location:file:/Users/zhangruibiao/Downloads/maven_repo/org/asynchttpclient/netty-resolver-dns/2.0.36/netty-resolver-dns-2.0.36.jarAction:Correct the classpath of your application so that it contains a single, compatible version of io.netty.resolver.dns.DnsAddressResolverGroupDisconnected from the target VM, address: '127.0.0.1:49930', transport: 'socket'Process finished with exit code 0

从错误中可以大概得到信息:尝试创建 DnsAddressResolverGroupFactory,但是方法不存在,这个方法有用的类来自于下边的三个jar包

分析:

①因为不能创建 DnsAddressResolverGroupFactory ,所以可以现在源码中找到该类,

通过方框中可以看到,该构造方法是报错的,并且提示不能解析改构造方法

②再点开这个构造函数

 

框中的构造函数的参数类型和调用的构造函数的参数类型不一致, 问题就出在这里

解决方法

①当前构造方法引用的jar包

 ②因为之前项目启动是没有问题,所有参考之前的引用

 ③根据对比和报错的提示,应该出现在 netty-resolver-dns-2.0.36.jar 这个jar包,在组件中应该也需要排除 netty-resolver-dns-2.0.36.jar 的引用

④启动之后发现仍然有问题,根据提示应该也需要排除 async-http-client-2.0.36.jar

 ⑤启动成功