事先声明:由于本人项目中的jar包都是本地jar,而都有用,属于第三方给我们挖的坑。
如果是maven仓库中的jar冲突,直接exclusion排除掉即可
不同的jar包内,有同包同名的class导致的noSuchMethod问题同包同名的类SecurityEngineDeal存在,导致strServerCert= sed.getServerCertificate()报noSuchMethod的错误。

private void getpath(Object o){
Class targetclass = o.getClass();
String className = targetclass.getName();
className = className.replace(’.’, ‘/’);
String resource = “/” + className + “.class”;
URL url = targetclass.getResource(resource);
System.out.println("============"+url.getFile());
}
通过该方法,能确定加载的class的全路径名为esspdf中的类,与预期不符
不同的jar包内,有同包同名的class导致的noSuchMethod问题

根据system classload的加载原则,加载target目录下web-inf 下的lib包时,会按照jar包名的的字母排列优先加载,而且加载后,同包同类名的类不会重复加载,所以导致了noSuchMethod的错误发生,

最简单粗暴的修改方法:需要优先被加载的包改名,让字母优先级排在那个冲突的包前面。

相关文章:

  • 2021-08-07
  • 2021-07-19
  • 2022-12-23
  • 2021-11-11
  • 2021-09-18
  • 2021-12-22
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2022-02-19
  • 2021-09-15
  • 2022-12-23
  • 2021-04-12
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案