Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.7.0
-
Patch
Description
Problem Description
"gremlin-core" declares "jcl-over-slf4j" as its dependency. However, it seems that the dependency is actually unused due to a dependency conflict.
There is another dependency "commons-logging:commons-logging" in the dependency tree as listed below:
org.apache.tinkerpop:gremlin-core:jar:3.7.0-SNAPSHOT \- org.apache.commons:commons-configuration2:jar:2.9.0:compile \- commons-logging:commons-logging:jar:1.2:compile \- org.slf4j:jcl-over-slf4j:jar:1.7.33:compile
The classes in "jcl-over-slf4j" are also in "commons-logging" as listed below:
[INFO] org.apache.commons.logging.impl.NoOpLog [INFO] org.apache.commons.logging.impl.SimpleLog$1 [INFO] org.apache.commons.logging.impl.SimpleLog [INFO] org.apache.commons.logging.impl.SLF4JLocationAwareLog [INFO] org.apache.commons.logging.impl.SLF4JLog [INFO] org.apache.commons.logging.impl.SLF4JLogFactory [INFO] org.apache.commons.logging.Log [INFO] org.apache.commons.logging.LogConfigurationException [INFO] org.apache.commons.logging.LogFactory
The problem is that "commons-logging" is ahead of "jcl-over-slf4j" in the dependency tree, thus ahead of "jcl-over-slf4j" in the classpath. When multiple JAR files contain the same class, the class loader will load the first occurrence it finds based on the classpath order. This means the classloader will select classes in "commons-logging" instead of "jcl-over-slf4j".
So despite "jcl-over-slf4j" being declared directly, it's actually unused. "commons-logging" is the actual used dependency, causing confusion.
Possible Solution
Change the order of "jcl-over-slf4j" and "commons-logging" so that "jcl-over-slf4j" appears ahead of "commons-logging" in the classpath. In this way, "jcl-over-slf4j" is used as intended.