scalaapache-sparklog4jslf4jphantom-dsl

Phantom: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path,


I have just plugged my spark application into Cassandra. I am using the Phantom Cassandra driver.

Now I get the following error during unit testing

Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path

The Exception is thrown during SparkCintext Initialization, This is caused because I now have Phantom dependencies in my pom.xml. (Seems crazy that Phantom would have a direct conflict with Spark, but there it is)

    <dependency>
        <groupId>com.outworkers</groupId>
        <artifactId>phantom-dsl_2.11</artifactId>
        <version>2.24.1</version>
    </dependency>

I can add an exclusion to Phantom to prevent log4j-over-slf4j.jar.

QUESTION: Is it safe to exclude log4j-over-slf4j.jar from Phantom or will it cause problems further down the line?


Solution

  • It is perfectly safe to exclude log4j-over-slf4j.jar from Phantom. It will not cause any problem other than logging library management. Which can be handled by slf4j-log4j12.jar.