soda-java
soda-java copied to clipboard
Upgrade jackson dependency to 2.x
I authored some classes with Jackson annotations which included references to Socrata classes such as Location. I couldn't figure out why I was getting the following exception:
Caused by: com.sun.jersey.api.client.ClientHandlerException: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.socrata.model.Location: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1d220bf1; line: 12, column: 5] (through reference chain: java.util.ArrayList[1]->com.johnathangilday.ingest.Arrest["location_1"])
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:563)
at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:523)
at com.socrata.api.Soda2Consumer.query(Soda2Consumer.java:112)
I believe this happens because my classes are decorated with Jackson 2.x annotations using the fasterxml packages, but Socrata classes are decorated with the long deprecated (years) Jackson 1.x annotations using the codehaus packages
Yes, jackson 1.x and 2.x are incompatible, though they share very similar interfaces