我正在jira插件上工作。當我嘗試部署,我收到一個錯誤:依賴於slf4j導致ClassLoader衝突
Error creating bean with name 'userService' defined in URL [bundle://205.0:1/com/softwareplant/tool/service/UserService.class]: Bean instantiation via constructor failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature; nested exception is org.springframework.beans.factory.BeanCreationException:
在該項目中我使用這種依賴關係:
[0;37m[INFO] +- com.atlassian.jira:jira-core:jar:7.0.0:provided[0m
[0;37m[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.9:provided[0m
[0;37m[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.9:provided[0m
[0;37m[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.7.9:provided[0m
[0;37m[INFO] +- org.slf4j:slf4j-api:jar:1.7.25:compile[0m
希望你有想法如何面對這一切。謝謝你的幫助! 感謝您的幫助!
如果'org.slf4j:slf4j-log4j12:jar:1.7.9'是「provided」,那麼'org.slf4j:slf4j-api:jar:1.7.9'也可能是「提供的」,所以不要「包括'org.slf4j:slf4j-api:jar:1.7.25'作爲「編譯」依賴。 – Andreas