我們正在面對與Storm 1.0.1和elasticsearch 5.2的gradle中的sl4j版本衝突。sl4j版本與Storm 1.0.1和elasticsearch的Gradle衝突5.2
我們發現ElasticSearch需要橋接log4j-to-slf4j,以便我們可以使用所需的記錄器。 這裏我們試圖用slf4j來使用logback-classic。
的依賴定義如下:
dependencies {
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'org.apache.logging.log4j:log4j-to-slf4j:2.6.2'
compile 'ch.qos.logback:logback-classic:1.1.10'
provided ('org.apache.storm:storm-core:1.0.1') {
exclude(group: 'org.slf4j', module: 'slf4j-api')
}
compile 'org.elasticsearch:elasticsearch:5.2.0'
compile 'org.elasticsearch.client:x-pack-transport:5.2.0'
}
要解決此我試圖排除風暴核心的SLF4J,並添加下同後:
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails dependencyResolveDetails ->
final requestedDependency = dependencyResolveDetails.requested
if (requestedDependency.group == 'org.slf4j' && requestedDependency.name == 'slf4j-api') {
requestedDependency.setVersion "1.7.7"
}
}
}
}
但當拓撲提交我們得到錯誤: SLF4J:類路徑包含多個SLF4J綁定。 SLF4J:在[jar:file:/Users/gauthamr05/Documents/Apps/Storm/apache-storm-1.0.1/lib/log4j-slf4j-impl-2.1.jar!/ org/slf4j/impl/StaticLoggerBinder中找到綁定.class] SLF4J:在[jar:file:/Users/gauthamr05/Documents/workspace/xyz_app/build/libs/FullIndexing.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到綁定SLF4J:有關http://www.slf4j.org/codes.html#multiple_bindings一個解釋。 SLF4J:實際綁定類型爲[org.apache.logging.slf4j.Log4jLoggerFactory] 線程「main」中的異常java.lang.StackOverflowError at org.apache.logging.log4j.spi.LoggerRegistry.getOrCreateInnerMap(LoggerRegistry.java :140) at org.apache.logging.log4j.spi.LoggerRegistry.hasLogger(LoggerRegistry.java:154) at org.apache.logging.slf4j.SLF4JLoggerContext.getLogger(SLF4JLoggerContext.java:38) at org.apache .logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:37) at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:29) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger (AbstractLoggerAdapter.java:47) at org.apache.logging.slf4j.Log4jLogg erFactory.getLogger(Log4jLoggerFactory.java:29) 在org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:277)