swagger-api / swagger-api/swagger-codegen
Java Jersey2 SDK trying to use CXF classes
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
We have a Spring Boot REST API for which we generated a Java-Jersey2 SDK using swagger-codegen-maven-plugin (v 2.2.2).
Now we have this other project where we want to use this SDK, but we also consume some other services through CXF clients.
When we call any service from our Jersey2 SDK, we are getting this:
Caused by: javax.ws.rs.client.ResponseProcessingException: No message body reader has been found for class com.starmount.inventory.client.model.ShipmentsDto, ContentType: application/json;charset=UTF-8
at org.apache.cxf.jaxrs.impl.ResponseImpl.reportMessageHandlerProblem(ResponseImpl.java:439)
at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity(ResponseImpl.java:390)
at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:326)
at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity(ResponseImpl.java:314)
at com.starmount.inventory.client.invoker.ApiClient.deserialize(ApiClient.java:561)
at com.starmount.inventory.client.invoker.ApiClient.invokeAPI(ApiClient.java:693)
at com.starmount.inventory.client.api.ShipmentApi.search(ShipmentApi.java:368)
My guess is that, being CXF and Jersey in the classpath, it's picking CXF Response implementation when it should use Jersey's.
Is there a way to handle this without migrating our SDK to CXF?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated invoker/ApiClient.java deserialization path, especially ApiClient.java:561 and :693, then trace the call from ShipmentApi.java:368. Reproduce the Jersey2 SDK call in an application that also has CXF clients and inspect which JAX-RS response and message-body-reader implementations are loaded. Done means identifying a supported configuration or dependency conflict resolution without migrating the SDK to CXF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100