maven jar包沖突3種解決方式


初次啟動應用,一直報如下錯誤,起初懷疑引入pandora-boot 版本沖突。

Exception in thread "main" java.lang.NoSuchMethodError: com.taobao.pandora.boot.loader.jmx.mbean.Health.registMBean()V
  at com.taobao.pandora.boot.loader.ReLaunchMainLauncher.launch(ReLaunchMainLauncher.java:39)
  at com.taobao.pandora.boot.PandoraBootstrap.run(PandoraBootstrap.java:41)
  at com.cainiao.wmpooc.OOCApplication.main(OOCApplication.java:27)
  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:497)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Process finished with exit code 1

方式一:通過mvn tree查看

mvn dependency:tree

方式二:通過在啟動過程中查看類文件位置

  • 查看Health 具體類路徑

查看到具體類路徑,輔助分析實際運行路徑

或者

Health.class.getProtectionDomain().getCodeSource().getLocation()

方式三:查找類文件

最終:找到引入依賴源頭,通過exclusions 進行排除


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM