Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

jackson-annotations are not included as a dependency within jackson-dataformat-csv #124

Closed
FortisJoe opened this issue May 25, 2016 · 4 comments
Milestone

Comments

@FortisJoe
Copy link

When I attempt to use jackson-dataformat-csv from maven as follows:

<dependency>
        <groupId>com.fasterxml.jackson.dataformat</groupId>
        <artifactId>jackson-dataformat-csv</artifactId>
        <version>2.7.0</version>
</dependency>

I encounter the following error:

java.lang.NoClassDefFoundError: com/fasterxml/jackson/annotation/JsonInclude$Value

at com.fasterxml.jackson.databind.cfg.MapperConfig.<clinit>(MapperConfig.java:45)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:535)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:461)
at com.fasterxml.jackson.dataformat.csv.CsvMapper.<init>(CsvMapper.java:44)
at com.fasterxml.jackson.dataformat.csv.CsvMapper.<init>(CsvMapper.java:39)

Adding the following resolves this issue:

     <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.7.0</version>
    </dependency>
@cowtowncoder
Copy link
Member

Hmmh. Ok, yes, introduction of value objects in jackson-annotations did make it a required dependency, not optional...

@cowtowncoder
Copy link
Member

Actually. Hmmh. No... the problem is not so much missing annotations, but more likely old version.
As far as I can see, CSV module does not directly depend on JsonInclude.Value, but jackson-databind does. It should (and does) have dependency on jackson-annotations.
What may happen is that version of annotations is older: JsonInclude.Value was added in 2.6. But I don't know how/why such version would be included -- maybe you can see what mvn dependency:tree says?

Now: I am open to improvements that could help, and perhaps direct addition of annotations makes sense. This because jackson-databind is a hard dependency (not "provided"), so annotations are needed no matter what.

@cowtowncoder cowtowncoder modified the milestones: 2.3.0, 2.7.5 May 25, 2016
@FortisJoe
Copy link
Author

Having had a look at the results of mvn dependency:tree things get interesting:

[INFO] zauber:user-import:jar:1.0-SNAPSHOT
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | - org.powermock:powermock-module-junit4-common:jar:1.6.4:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.4:test
[INFO] | | - org.javassist:javassist:jar:3.20.0-GA:test
[INFO] | - org.powermock:powermock-reflect:jar:1.6.4:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.4:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | - org.powermock:powermock-api-support:jar:1.6.4:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | - org.objenesis:objenesis:jar:2.1:test
[INFO] +- zauber:okta-sdk-wrapper:jar:1.0-SNAPSHOT:compile
[INFO] | +- com.okta:okta-sdk:jar:0.0.4-SNAPSHOT:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile
[INFO] | | +- joda-time:joda-time:jar:2.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.5.0:compile
[INFO] | | - org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | - commons-codec:commons-codec:jar:1.9:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.10:compile
[INFO] | - com.google.guava:guava:jar:19.0:compile
[INFO] - com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.7.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.7.0:compile
[INFO] - com.fasterxml.jackson.core:jackson-databind:jar:2.7.0:compile

Removing the dependency on zauber:okta-sdk-wrapper:jar:1.0-SNAPSHOT:compile results in the following:

[INFO] zauber:user-import:jar:1.0-SNAPSHOT
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | - org.powermock:powermock-module-junit4-common:jar:1.6.4:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.4:test
[INFO] | | - org.javassist:javassist:jar:3.20.0-GA:test
[INFO] | - org.powermock:powermock-reflect:jar:1.6.4:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.4:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | - org.powermock:powermock-api-support:jar:1.6.4:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | - org.objenesis:objenesis:jar:2.1:test
[INFO] - com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.7.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.7.0:compile
[INFO] - com.fasterxml.jackson.core:jackson-databind:jar:2.7.0:compile
[INFO] - com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile

Which is correct behavior.

Checking out a branch of the 2.7.0 release and removing the test scope from the jackson-annotations dependency, while reintroducing the zauber:okta-sdk-wrapper:jar:1.0-SNAPSHOT:compile dependency results in the following:

[INFO] zauber:user-import:jar:1.0-SNAPSHOT
[INFO] +- org.powermock:powermock-module-junit4:jar:1.6.4:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | - org.powermock:powermock-module-junit4-common:jar:1.6.4:test
[INFO] | +- org.powermock:powermock-core:jar:1.6.4:test
[INFO] | | - org.javassist:javassist:jar:3.20.0-GA:test
[INFO] | - org.powermock:powermock-reflect:jar:1.6.4:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.6.4:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | - org.powermock:powermock-api-support:jar:1.6.4:test
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | - org.objenesis:objenesis:jar:2.1:test
[INFO] +- zauber:okta-sdk-wrapper:jar:1.0-SNAPSHOT:compile
[INFO] | +- com.okta:okta-sdk:jar:0.0.4-SNAPSHOT:compile
[INFO] | | +- joda-time:joda-time:jar:2.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.5.0:compile
[INFO] | | - org.apache.httpcomponents:httpclient:jar:4.5.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.2:compile
[INFO] | | - commons-codec:commons-codec:jar:1.9:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.10:compile
[INFO] | - com.google.guava:guava:jar:19.0:compile
[INFO] - com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.7.1-SNAPSHOT:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.7.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.0:compile
[INFO] - com.fasterxml.jackson.core:jackson-annotations:jar:2.7.0:compile

Which confirms to me that the fix introduced in 34f405d works.

Many thanks!

@cowtowncoder
Copy link
Member

@zauberjoe thank you for verifying this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants