cm_api
cm_api copied to clipboard
Java Client is using deprecated Jackson2 object references in the class ApiObjectMapper
The project uses an older version of Jackson2 and references the deprecated AnnotationIntrospector$Pair class. This causes problems if you are trying to use this client with a project that has a Jackson2 version greater than 2.2
The class ApiObjectMapper should reference new AnnotationIntrospectorPair( ...) not Pair(...)
To get this to work you also need to update the cxf.verision to 2.7.8 Below are the changes to allow usage of Jackson2 versions 2.3 or later:
pom.xml
<properties>
<cxf.version>2.7.8</cxf.version>
<guava.version>14.0</guava.version>
<jackson2.version>2.3.4</jackson2.version>
<joda.version>2.1</joda.version>
<junit.version>4.11</junit.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<test.redirectToFile>true</test.redirectToFile>
<privateClassPath>com.cloudera.api.shaded</privateClassPath>
</properties>
ApiObjectMapper constructor
public ApiObjectMapper() {
// Print the JSON with indentation (ie. pretty print)
configure(SerializationFeature.INDENT_OUTPUT, true);
// Allow JAX-B annotations.
setAnnotationIntrospector(
new AnnotationIntrospectorPair(
getSerializationConfig().getAnnotationIntrospector(),
new JaxbAnnotationIntrospector(getTypeFactory())));
// Make Jackson respect @XmlElementWrapper.
enable(MapperFeature.USE_WRAPPER_NAME_AS_PROPERTY_NAME);
// Print all dates in ISO8601 format
setDateFormat(makeISODateFormat());
}
Same here. Hope Cloudera can fix it in a future path version.
did you find a workaround to that problem, assuming i'd like to use a newer version of jackson?