我收到以下错误:LinkageError类 - 装载机约束冲突 - 解决方法时, “org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()”
ContextListenerjava.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader '[email protected] (urls: ['], parents: [)'[email protected]']) of the current class, org/slf4j/LoggerFactory, and the class loader 'System (urls: [''file:/usr/lib/jvm/jvm_8/jvm_8/lib/jvmx.jar', 'file:/usr/lib/jvm/jvm_8/jvm_8/lib/tools.jar', 'file:/ ....
它通过默认包slf4j
看来我的云平台,我得到这个错误,因为我也把slf4j作为依赖在我的pom文件和两个不同的类加载器正在加载slf4j
我解决这个问题的方式是改变在POM依赖项的范围提供。
但副作用是我无法在我的本地tomcat上运行它,因为它找不到slf4j库。
在这种情况下可以做些什么,这样我的战争在我的云平台和我的本地tomcat上运行良好?