Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectMapper provided by JacksonAutoConfiguration via JacksonClusterEnvironmentBuilderCustomizer breaks Couchbase driver #26363

Closed
mp911de opened this issue May 5, 2021 · 2 comments
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@mp911de
Copy link
Member

mp911de commented May 5, 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:

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.

/cc @mikereiche

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 5, 2021
@wilkinsona
Copy link
Member

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.

@mp911de
Copy link
Member Author

mp911de commented May 5, 2021

You need a running Couchbase server, you can run the Spring Data example at https://github.com/spring-projects/spring-data-examples/tree/main/couchbase/example (currently disabled because of the issue).

@wilkinsona 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
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels May 6, 2021
@wilkinsona wilkinsona added this to the 2.5.0 milestone May 6, 2021
@wilkinsona wilkinsona self-assigned this May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
3 participants