You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Spring Boot defaults with Couchbase, then Couchbase operations are affected by the ObjectMapper that gets configured by Spring Boot causing driver failures. Something like:
com.couchbase.client.core.error.CouchbaseException: query did not project __id. Either use #{#n1ql.selectEntity} or project __id and __cas : SELECT META(`travel-sample`).id AS __id, META(`travel-sample`).cas AS __cas, `name`, `iata`, `icao`, `callsign`, `country` FROM `travel-sample` WHERE `_class` = "example.springdata.couchbase.model.Airline"
Couchbase driver requires a specific Jackson Module to be registered that is shipped with the driver (com.couchbase.client.java.json.JsonValueModule) so that Couchbase's JsonObject and JsonArray can be used for JSON exchange.
I'd recommend improving the arrangement by registering JsonValueModule when Couchbase is on the classpath and when JacksonClusterEnvironmentBuilderCustomizer is used.
Thanks, Mark. Is there a relatively straightforward way in which we can reproduce the problem? When we fix this, it'd be good if we could add a test that verifies things work as expected. If it's too involved, we could just check that the module's been registered.
wilkinsona
changed the title
ObjectMapper provided by JacksonAutoConfiguration via JacksonClusterEnvironmentBuilderCustomizer breaks Couchbase driver
ObjectMapper provided by JacksonAutoConfiguration via JacksonClusterEnvironmentBuilderCustomizer breaks Couchbase driver
May 6, 2021
When using Spring Boot defaults with Couchbase, then Couchbase operations are affected by the
ObjectMapper
that gets configured by Spring Boot causing driver failures. Something like:Couchbase driver requires a specific Jackson Module to be registered that is shipped with the driver (
com.couchbase.client.java.json.JsonValueModule
) so that Couchbase'sJsonObject
andJsonArray
can be used for JSON exchange.I'd recommend improving the arrangement by registering
JsonValueModule
when Couchbase is on the classpath and whenJacksonClusterEnvironmentBuilderCustomizer
is used./cc @mikereiche
The text was updated successfully, but these errors were encountered: