Rest-assured: Emphasize in the exception that 'Jackson (databind)' is required

Created on 19 Jan 2017  路  5Comments  路  Source: rest-assured/rest-assured

Hi,

I was about to submit an issue saying that Jackson doesn't work with RestAssured. But figured out the cause by double-checking the documentation. :)

Before including any JSON serializer into the class path I had seen the exception:

java.lang.IllegalStateException: Cannot serialize object because no JSON serializer found in classpath. Please put either Jackson or Gson in the classpath.

Then googled by 'Jackson', found and added dependency to 'jackson-core'

    dependencies {  
      testCompile 'io.rest-assured:rest-assured:3.0.1'  
      testCompile 'com.fasterxml.jackson.core:jackson-core:2.8.6'  
    }

which apparently wouldn't work. To make it work the dependency should have been

'com.fasterxml.jackson.core:jackson-databind:2.8.6'

I suppose it may save few people some time if the exception text says that RestAssured requires exactly 'Jackson (databind)', not anything else.
This is mentioned in the documentation, but not in the exception.

Thanks in advance!

Most helpful comment

@GhabriA You need a jackson-databind dependency. Here is the link to the latest version:
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.5
There choose the build tool you use in your project (Maven, Gradle, etc.) and copy it to your build file.

All 5 comments

Thanks for the advise, I've fixed this in master now. The message now reads:

Cannot serialize object because no JSON serializer found in classpath. Please put either Jackson (Databind) or Gson in the classpath.

Hello, I'm having the same exception :Cannot deserialize object because no JSON deserializer found in classpath. Please put either Jackson (Databind) or Gson in the classpath.

How how to add JSON deserializer in classpath ?
And according to your answer : You added dependency to 'jackson-core', how can I find this file?

Thank you in advance .

@GhabriA You need a jackson-databind dependency. Here is the link to the latest version:
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind/2.9.5
There choose the build tool you use in your project (Maven, Gradle, etc.) and copy it to your build file.

It is helped me too. Thanks!

@vpedash
thank you helped a lot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garretwilson picture garretwilson  路  3Comments

johanhaleby picture johanhaleby  路  4Comments

lovetemple picture lovetemple  路  4Comments

osandadeshan picture osandadeshan  路  4Comments

johanhaleby picture johanhaleby  路  6Comments