Xgbn Xgbn - 3 months ago 56
Java Question

log4j-over-slf4j.jar and slf4j-log4j12.jar conflicted… but i don't have slf4j-log4j12.jar

I came across this problem when trying to integrate kafka, storm and druid.

Their corresponding versions are:

kafka_2.11-0.8.2.2
druid-0.9.1.1
apache-storm-0.10.1


log4j-over-slf4j.jar and slf4j-log4j12.jar conflitct... but i don't have log4j-over-slf4j
This question almost resembles my question except that I got this error even though I have excluded slf4j-log4j12.jar. This is how the error looks like in storm log that corresponding to a KafkaSpout(storm.kafka.KafkaSpout):

2016-08-02 14:54:50.446 STDIO [ERROR] SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
2016-08-02 14:54:50.446 o.s.c.ConfigurationObjectFactory [INFO] Using method itself for [task.warmingPeriod] on [com.metamx.tranquility.config.PropertiesBasedConfig#taskWarmingPeriod()]
2016-08-02 14:54:50.446 STDIO [ERROR] SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
2016-08-02 14:54:50.447 b.s.util [ERROR] Async loop died!
java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Log4jLoggerFactory


This is my output for
mvn dependency:tree


[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ CloudStormDruid ---
[INFO] com.cloud.xxx:CloudStormDruid:war:1.0
[INFO] +- io.druid:tranquility-core_2.11:jar:0.8.2:compile
[INFO] | +- org.scala-lang:scala-library:jar:2.11.7:compile
[INFO] | +- com.metamx:scala-util_2.11:jar:1.11.6:compile
[INFO] | | +- com.metamx:loglady_2.11:jar:1.1.0-mmx:compile
[INFO] | | +- com.metamx:http-client:jar:1.0.3:compile
[INFO] | | +- com.metamx:emitter:jar:0.3.3:compile
[INFO] | | +- com.metamx:server-metrics:jar:0.2.6:compile
[INFO] | | +- joda-time:joda-time:jar:2.1:compile
[INFO] | | +- org.joda:joda-convert:jar:1.6:compile
[INFO] | | +- org.scalaj:scalaj-time_2.11:jar:0.5:compile
[INFO] | | +- org.skife.config:config-magic:jar:0.9:compile
[INFO] | | +- com.google.guava:guava:jar:16.0.1:compile
[INFO] | | +- org.yaml:snakeyaml:jar:1.11:compile
[INFO] | | +- org.jdbi:jdbi:jar:2.27:compile
[INFO] | | +- com.h2database:h2:jar:1.3.158:compile
[INFO] | | +- c3p0:c3p0:jar:0.9.1.2:compile
[INFO] | | +- org.apache.zookeeper:zookeeper:jar:3.4.5:compile
[INFO] | | +- org.apache.curator:curator-recipes:jar:2.6.0:compile
[INFO] | | \- org.apache.curator:curator-x-discovery:jar:2.6.0:compile
[INFO] | +- com.metamx:java-util:jar:0.27.4:compile
[INFO] | | \- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] | +- io.netty:netty:jar:3.10.5.Final:compile
[INFO] | +- com.twitter:util-core_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-function_2.11:jar:6.30.0:compile
[INFO] | | \- com.twitter:jsr166e:jar:1.0.0:compile
[INFO] | +- com.twitter:finagle-core_2.11:jar:6.31.0:compile
[INFO] | | +- com.twitter:util-app_2.11:jar:6.30.0:compile
[INFO] | | | \- com.twitter:util-registry_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-cache_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-codec_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-collection_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-hashing_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-jvm_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-lint_2.11:jar:6.30.0:compile
[INFO] | | +- com.twitter:util-logging_2.11:jar:6.30.0:compile
[INFO] | | \- com.twitter:util-stats_2.11:jar:6.30.0:compile
[INFO] | +- com.twitter:finagle-http_2.11:jar:6.31.0:compile
[INFO] | +- org.slf4j:jul-to-slf4j:jar:1.7.12:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.4.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.6:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.6:compile
[INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.4.6:compile
[INFO] | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.4.6:compile
[INFO] | +- com.fasterxml.jackson.module:jackson-module-scala_2.11:jar:2.4.5:compile
[INFO] | | +- org.scala-lang:scala-reflect:jar:2.11.2:compile
[INFO] | | +- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
[INFO] | | \- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO] | +- io.druid:druid-server:jar:0.9.1:compile
[INFO] | | +- io.druid:druid-processing:jar:0.9.1:compile
[INFO] | | | +- io.druid:druid-common:jar:0.9.1:compile
[INFO] | | | | +- io.druid:druid-api:jar:0.9.1:compile
[INFO] | | | | | \- io.airlift:airline:jar:0.7:compile
[INFO] | | | | | \- com.google.code.findbugs:annotations:jar:2.0.3:compile
[INFO] | | | | +- org.apache.commons:commons-dbcp2:jar:2.0.1:compile
[INFO] | | | | +- commons-pool:commons-pool:jar:1.6:compile
[INFO] | | | | +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | | | | | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] | | | | +- javax.el:javax.el-api:jar:3.0.0:compile
[INFO] | | | | +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.4.6:compile
[INFO] | | | | +- org.apache.logging.log4j:log4j-jul:jar:2.5:compile
[INFO] | | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] | | | | +- net.java.dev.jets3t:jets3t:jar:0.9.4:compile
[INFO] | | | | | +- javax.activation:activation:jar:1.1.1:compile
[INFO] | | | | | \- com.jamesmurty.utils:java-xmlbuilder:jar:1.1:compile
[INFO] | | | | | \- net.iharder:base64:jar:2.3.8:compile
[INFO] | | | | \- org.antlr:antlr4-runtime:jar:4.5.1:compile
[INFO] | | | +- com.metamx:bytebuffer-collections:jar:0.2.4:compile
[INFO] | | | | +- com.metamx:extendedset:jar:1.3.9:compile
[INFO] | | | | \- org.roaringbitmap:RoaringBitmap:jar:0.5.16:compile
[INFO] | | | +- com.ning:compress-lzf:jar:1.0.3:compile
[INFO] | | | +- com.ibm.icu:icu4j:jar:4.8.1:compile
[INFO] | | | +- org.mozilla:rhino:jar:1.7R5:compile
[INFO] | | | \- org.mapdb:mapdb:jar:1.0.8:compile
[INFO] | | +- io.druid:druid-aws-common:jar:0.9.1:compile
[INFO] | | | \- com.amazonaws:aws-java-sdk:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-support:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-simpledb:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-simpleworkflow:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-storagegateway:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-route53:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-s3:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-importexport:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sts:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sqs:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-rds:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-redshift:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticbeanstalk:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-glacier:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-iam:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-datapipeline:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticloadbalancing:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-emr:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elasticache:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-elastictranscoder:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ec2:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-dynamodb:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-sns:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudtrail:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudwatch:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-logs:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cognitoidentity:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cognitosync:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-directconnect:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudformation:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudfront:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-kinesis:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-opsworks:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ses:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-autoscaling:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudsearch:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudwatchmetrics:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-swf-libraries:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codedeploy:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codepipeline:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-kms:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-config:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-lambda:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ecs:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-cloudhsm:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-ssm:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-workspaces:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-machinelearning:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-directory:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-efs:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-codecommit:jar:1.10.21:compile
[INFO] | | | +- com.amazonaws:aws-java-sdk-devicefarm:jar:1.10.21:compile
[INFO] | | | \- com.amazonaws:aws-java-sdk-core:jar:1.10.21:compile
[INFO] | | +- io.druid:druid-console:jar:0.0.3:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | +- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.4.6:compile
[INFO] | | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.4.6:compile
[INFO] | | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.4.6:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-smile-provider:jar:2.4.6:compile
[INFO] | | +- com.sun.jersey:jersey-server:jar:1.19:compile
[INFO] | | +- com.sun.jersey:jersey-core:jar:1.19:compile
[INFO] | | | \- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] | | +- com.sun.jersey.contribs:jersey-guice:jar:1.19:compile
[INFO] | | | \- com.sun.jersey:jersey-servlet:jar:1.19:compile
[INFO] | | +- org.eclipse.jetty:jetty-server:jar:9.2.5.v20141112:compile
[INFO] | | | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | | | +- org.eclipse.jetty:jetty-http:jar:9.2.5.v20141112:compile
[INFO] | | | \- org.eclipse.jetty:jetty-io:jar:9.2.5.v20141112:compile
[INFO] | | +- org.eclipse.jetty:jetty-proxy:jar:9.2.5.v20141112:compile
[INFO] | | | +- org.eclipse.jetty:jetty-client:jar:9.2.5.v20141112:compile
[INFO] | | | \- org.eclipse.jetty:jetty-util:jar:9.2.5.v20141112:compile
[INFO] | | +- io.tesla.aether:tesla-aether:jar:0.0.5:compile
[INFO] | | | +- org.eclipse.aether:aether-spi:jar:0.9.0.M2:compile
[INFO] | | | +- org.eclipse.aether:aether-util:jar:0.9.0.M2:compile
[INFO] | | | +- org.eclipse.aether:aether-impl:jar:0.9.0.M2:compile
[INFO] | | | +- org.eclipse.aether:aether-connector-file:jar:0.9.0.M2:compile
[INFO] | | | +- io.tesla.aether:aether-connector-okhttp:jar:0.0.9:compile
[INFO] | | | | +- com.squareup.okhttp:okhttp:jar:1.0.2:compile
[INFO] | | | | \- org.apache.maven.wagon:wagon-provider-api:jar:2.4:compile
[INFO] | | | +- org.apache.maven:maven-aether-provider:jar:3.1.1:compile
[INFO] | | | | +- org.apache.maven:maven-model:jar:3.1.1:compile
[INFO] | | | | +- org.apache.maven:maven-model-builder:jar:3.1.1:compile
[INFO] | | | | +- org.apache.maven:maven-repository-metadata:jar:3.1.1:compile
[INFO] | | | | \- org.codehaus.plexus:plexus-utils:jar:3.0.15:compile
[INFO] | | | +- org.apache.maven:maven-settings-builder:jar:3.1.1:compile
[INFO] | | | | \- org.codehaus.plexus:plexus-interpolation:jar:1.19:compile
[INFO] | | | \- org.apache.maven:maven-settings:jar:3.1.1:compile
[INFO] | | +- org.eclipse.aether:aether-api:jar:0.9.0.M2:compile
[INFO] | | +- net.spy:spymemcached:jar:2.11.7:compile
[INFO] | | +- net.jpountz.lz4:lz4:jar:1.3.0:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlet:jar:9.2.5.v20141112:compile
[INFO] | | | \- org.eclipse.jetty:jetty-security:jar:9.2.5.v20141112:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlets:jar:9.2.5.v20141112:compile
[INFO] | | | \- org.eclipse.jetty:jetty-continuation:jar:9.2.5.v20141112:compile
[INFO] | | +- com.ircclouds.irc:irc-api:jar:1.0-0014:compile
[INFO] | | +- com.maxmind.geoip2:geoip2:jar:0.4.0:compile
[INFO] | | | +- com.maxmind.maxminddb:maxminddb:jar:0.2.0:compile
[INFO] | | | \- com.google.http-client:google-http-client-jackson2:jar:1.15.0-rc:compile
[INFO] | | +- org.apache.derby:derby:jar:10.11.1.1:compile
[INFO] | | +- org.apache.derby:derbynet:jar:10.11.1.1:compile
[INFO] | | +- org.apache.derby:derbyclient:jar:10.11.1.1:compile
[INFO] | | \- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] | +- com.google.inject:guice:jar:4.0:compile
[INFO] | +- com.google.inject.extensions:guice-servlet:jar:4.0:compile
[INFO] | +- com.google.inject.extensions:guice-multibindings:jar:4.0:compile
[INFO] | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- io.druid:tranquility-storm_2.11:jar:0.8.2:compile
[INFO] +- org.apache.storm:storm-core:jar:0.10.1:provided
[INFO] | +- com.esotericsoftware.kryo:kryo:jar:2.21:provided
[INFO] | | +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:provided
[INFO] | | | \- org.ow2.asm:asm:jar:4.0:provided
[INFO] | | \- com.esotericsoftware.minlog:minlog:jar:1.2:provided
[INFO] | +- org.clojure:clojure:jar:1.6.0:provided
[INFO] | +- com.googlecode.disruptor:disruptor:jar:2.10.4:provided
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.1:provided
[INFO] | +- org.apache.logging.log4j:log4j-core:jar:2.1:provided
[INFO] | +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:provided
[INFO] | +- org.slf4j:log4j-over-slf4j:jar:1.6.6:provided
[INFO] | \- org.apache.hadoop:hadoop-auth:jar:2.4.0:provided
[INFO] +- org.apache.storm:storm-kafka:jar:0.10.1:compile
[INFO] | +- commons-io:commons-io:jar:2.4:compile
[INFO] | +- org.apache.curator:curator-framework:jar:2.5.0:compile
[INFO] | | \- org.apache.curator:curator-client:jar:2.5.0:compile
[INFO] | +- commons-lang:commons-lang:jar:2.5:compile
[INFO] | \- com.googlecode.json-simple:json-simple:jar:1.1:compile
[INFO] +- org.apache.kafka:kafka_2.11:jar:0.8.2.2:compile
[INFO] | +- org.scala-lang.modules:scala-xml_2.11:jar:1.0.2:compile
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | +- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
[INFO] | +- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.2:compile
[INFO] | +- com.101tec:zkclient:jar:0.3:compile
[INFO] | \- org.apache.kafka:kafka-clients:jar:0.8.2.2:compile
[INFO] | \- org.xerial.snappy:snappy-java:jar:1.1.1.7:compile
[INFO] +- com.jayway.jsonpath:json-path:jar:2.0.0:compile
[INFO] | \- net.minidev:json-smart:jar:2.1.1:compile
[INFO] | \- net.minidev:asm:jar:1.0.2:compile
[INFO] | \- asm:asm:jar:3.3.1:compile
[INFO] +- com.cloud.base:CloudUtil:jar:1.0:compile
[INFO] | +- com.aliyun.odps:odps-sdk-core:jar:0.20.7-public:compile
[INFO] | | +- com.aliyun.odps:odps-sdk-commons:jar:0.20.7-public:compile
[INFO] | | | \- com.jcabi:jcabi-aspects:jar:0.20.1:compile
[INFO] | | | +- com.jcabi:jcabi-log:jar:0.15:compile
[INFO] | | | \- org.aspectj:aspectjrt:jar:1.8.2:compile
[INFO] | | +- commons-codec:commons-codec:jar:1.9:compile
[INFO] | | +- net.sourceforge.javacsv:javacsv:jar:2.0:compile
[INFO] | | +- org.bouncycastle:bcprov-jdk15on:jar:1.52:compile
[INFO] | | \- com.google.protobuf:protobuf-java:jar:2.4.1:compile
[INFO] | +- org.apache.struts:struts2-core:jar:2.3.15.1:compile
[INFO] | | +- org.apache.struts.xwork:xwork-core:jar:2.3.15.1:compile
[INFO] | | | \- asm:asm-commons:jar:3.3:compile
[INFO] | | | \- asm:asm-tree:jar:3.3:compile
[INFO] | | +- org.freemarker:freemarker:jar:2.3.19:compile
[INFO] | | \- ognl:ognl:jar:3.0.6:compile
[INFO] | +- org.apache.struts:struts2-spring-plugin:jar:2.3.15.1:compile
[INFO] | +- org.apache.struts:struts2-convention-plugin:jar:2.3.15.1:compile
[INFO] | +- org.apache.struts:struts2-json-plugin:jar:2.3.15.1:compile
[INFO] | +- com.thoughtworks.xstream:xstream:jar:1.4.5:compile
[INFO] | | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] | +- com.lowagie:itext:jar:2.1.7:compile
[INFO] | | +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] | | +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] | | \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] | | +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] | | \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] | +- com.lowagie:itextasian:jar:1.0:compile
[INFO] | +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | | \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | +- net.sourceforge.jexcelapi:jxl:jar:2.6.10:compile
[INFO] | +- commons-fileupload:commons-fileupload:jar:1.3:compile
[INFO] | +- org.apache.commons:commons-compress:jar:1.6:compile
[INFO] | | \- org.tukaani:xz:jar:1.4:compile
[INFO] | +- org.apache.poi:poi:jar:3.9:compile
[INFO] | +- org.apache.poi:poi-ooxml:jar:3.9:compile
[INFO] | | \- org.apache.poi:poi-ooxml-schemas:jar:3.9:compile
[INFO] | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | +- jaxen:jaxen:jar:1.1.6:compile
[INFO] | +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | | \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO] | +- com.alibaba:dubbo:jar:2.5.3:compile
[INFO] | +- org.apache.zookeeper:zookeeper:pom:3.4.5:compile
[INFO] | | \- jline:jline:jar:0.9.94:compile
[INFO] | +- redis.clients:jedis:jar:2.7.2:compile
[INFO] | | \- org.apache.commons:commons-pool2:jar:2.3:compile
[INFO] | +- org.springframework.data:spring-data-redis:jar:1.6.0.RELEASE:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.5.1:compile
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.4.3:compile
[INFO] | \- org.jdom:jdom:jar:1.1.3:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.2.1-b03:provided
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] +- com.alibaba:fastjson:jar:1.1.24:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.7.0:compile
[INFO] +- com.alibaba:druid:jar:1.0.3:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.21:compile
[INFO] +- junit:junit:jar:4.10:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] +- org.hibernate:hibernate-core:jar:4.1.7.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.7:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] | \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:4.1.7.Final:compile
[INFO] | \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] +- org.springframework:spring-core:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-aop:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-tx:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.2.4.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-expression:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.2.4.RELEASE:compile
[INFO] +- org.projectreactor:reactor-spring:jar:1.0.1.RELEASE:compile
[INFO] | \- org.projectreactor:reactor-core:jar:1.0.1.RELEASE:compile
[INFO] | \- com.lmax:disruptor:jar:3.2.0:compile
[INFO] +- org.springframework:spring-test:jar:3.2.4.RELEASE:test
[INFO] \- org.springframework:spring-context-support:jar:3.2.4.RELEASE:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------


I excluded slf4j-log4j12.jar for kafka as such in my pom.xml:

<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-kafka</artifactId>
<version>0.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>0.8.2.2</version>
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>

</exclusions>
</dependency>


And I used maven-assembly-plugin to build a distribution bin for storm-nimbus to parse:

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.cloud.storm.topology.TopologyService</mainClass>
</manifest>
</archive>
</configuration>

</plugin>


What would be the cause of this problem? What would I have to do if I want to exclude slf4j-log4j12 and keep log4j-over-slf4j?

Thanks in Advance.

Answer

When you exclude it from your kafka dependency, you are excluding the logging dependencies storm requires that were coming transitively. To solve it, you need to declare it explicitly by including slf4j-api and log4j-over-sl4j in your dependency list, as below:

<dependencies>
    <!-- (...) some other dependencies (...) -->
    <dependency>
        <!-- should be excluded from the shaded binary-->
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>${storm.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-kafka</artifactId>
        <version>${storm-kafka.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.kafka</groupId>
        <artifactId>kafka_2.11</artifactId>
        <version>${kafka.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
    </dependency>

</dependencies>

Just as a notice, I normally use maven-shade-plugin to build the binary package for nimbus, as this is the recommended way and makes your life easier by providing the ability to merge manifest entries. This can be done as below:

<plugins>
    <!-- (...) some other plugins (...) -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <configuration>
            <minimizeJar>false</minimizeJar>
            <artifactSet>
                <excludes>
                    <exclude>org.apache.storm:storm-core</exclude>
                </excludes>
            </artifactSet>
            <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <mainClass>MyTopologyMainClassFQDN</mainClass>
                </transformer>
            </transformers>
        </configuration>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                     <goal>shade</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
</plugins>
Comments