htm.java
htm.java copied to clipboard
java.lang.NoSuchMethodError caused by dependency conflict issue due to multiple versions of com.fasterxml.jackson.core:jackson-core:jar
Hi, there are multiple versions of com.fasterxml.jackson.core:jackson-core:jar in org.numenta:htm.java:jar:0.6.13. As shown in the following dependency tree, based on "Maven's nearest wins strategy", only com.fasterxml.jackson.core:jackson-core:jar:2.4.4 will be loaded and the other conflicting versions will be shadowed, during the packaging process.
However, method <com.fasterxml.jackson.core.JsonParser: java.lang.String nextFieldName()> only exists in jackson-core 2.5.3 and not included in the loaded jackson-core:jar:2.4.4. As a result, an exception will be thrown with the following stack trace, when your project invoking the missing method.
Stack trace
Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonParser.nextFieldName()Ljava/lang/String; at org.nustaq.serialization.coders.FSTJsonDecoder.readObjectHeaderTag(FSTJsonDecoder.java:329) at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:340) at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:327) at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:298) at org.numenta.nupic.Parameters.readForNetwork(Parameters.java:1174)
Dependency tree
org.numenta:htm.java:jar:0.6.13 +- joda-time:joda-time:jar:2.5:compile +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.4:compile +- com.fasterxml.jackson.core:jackson-core:jar:2.4.4:compile +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.4:compile | +- (com.fasterxml.jackson.core:jackson-annotations:jar:2.4.0:compile - omitted for conflict with 2.4.4) | - (com.fasterxml.jackson.core:jackson-core:jar:2.4.4:compile - omitted for duplicate) +- de.ruedigermoeller:fst:jar:2.45:compile | +- (com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile - omitted for conflict with 2.4.4) | +- org.javassist:javassist:jar:3.19.0-GA:compile | - org.objenesis:objenesis:jar:2.1:compile - algorithmfoundry:algorithmfoundry-shade-culled:jar:1.3:compile
Solution
Upgrade jackson (include jackson-annotations, jackson-core and jackson-databind) to version 2.5.3 to keep consistent with de.ruedigermoeller:fst.
Thanks
Regards, Leo
@cogmission , May I pull a request to fix this issue?
@LeoAugust19 Yes, of course!
- You will need to fill out the Numenta Contributor's License
- Create a branch and submit it on that.
- @rhyolight will need to ok your CL once you've filled it out. (Not a big deal)
Thank you for your interest in making HTM.java the best it can be! David
@cogmission Thanks a lot, I will do that.
@cogmission Please forgive me for asking you a further question.
We provide the above two types of information: A: The missing method and conflicting jars are identifed by static analysis. B: Stack trace is triggered by test case.
Which type of information is more useful for you to confirm it's a bug?
@LeoAugust19
Hi, I’m on vacation right now. Will be back toward end of August... Please hold tight. Thanks, David