0

I am trying to pass JSON data in a post to a Jersey- based REST service. After getting HTTP 415 errors, I researched and learned that Jersey needs certain Jackson Jars in order to handle JSON.

I have been trying to find the correct Jars, but every link I am finding seems to point to places where there are a lot of README files and XML files but no Jars!

There are also several links provided here on Stack Overflow to Jackson jars. They either don't work, point to links without jars, or point to versions that will not work with Jersey v2.

Worse, I cannot find a consistent list of the Jackson jars needed for Jersey! I keep seeing different lists of Jar files that I cannot find.

Can someone please point me to the correct Jackson jars needed to provide Jersey with JSON processing??? Where can I find and download them?

Factor Three
  • 2,094
  • 5
  • 35
  • 51
  • You've identified the *exact* reason that questions asking us to find links to things are off-topic here - because links become dead, are moved, become outdated, etc. See the [help/on-topic] pages for more information, specifically the numbered list on that page. Good luck. – Ken White Aug 19 '15 at 00:57
  • http://mvnrepository.com/ – saugata Aug 19 '15 at 01:03
  • What Jersey version are you using? There's no such thing as "v3". If I know the version I can tell you exactly which jars you should grab. – Paul Samsotha Aug 19 '15 at 03:46
  • OOPS -- Typo. It is Jersey 2.2.1. – Factor Three Aug 19 '15 at 14:17

1 Answers1

3

Just grab all the below Jars.

jackson deps

You can find all of them here. Just search for them individually.

If you are registering your providers individually, regiser

  • JacksonJaxbJsonProvider for basic JSON/POJO support.
  • JsonMappingExceptionMapper for an ExceptionMapper for JsonMappingException
  • JsonParseExceptionMapper for an ExceptionMapper for JsonParseException

Or if you are registering packages to be scanned, add this package

  • com.fasterxml.jackson.jaxrs.json

Note: The above image is from an older post. Jackson is at 2.6.1 right now. If you want, you can get the newest version. Doesn't make a difference. Just make sure all the jars are the same version

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
  • This solved the Jackson problem, but apparently not the underlying one. Apparently, just adding Jackson to a base Tomcat Jersey setup does *not* solve the HTTP Error 415 problem... – Factor Three Aug 19 '15 at 17:54
  • Maybe you missed the second part of the answer. You still need to register the JAX-RS provider. So unless you register the provider by package, best to include the jars into your app, and not the tomcat install. Maybe read [this](http://stackoverflow.com/a/31991892/2587435) and [this](http://stackoverflow.com/a/30692580/2587435) for a better understanding. – Paul Samsotha Aug 19 '15 at 19:50