Hi Aki, Ron
This is actually available in
https://github.com/swagger-api/swagger-core/blob/develop_2.0/samples/java-jaxrs-cxf/src/main/resources/applicationContext.xml
(the endpoint creation looks a bit complex, jaxrs:endpoint, possibly
with the auto discovery enabled would look much simpler), but the
problem appears to be due to the fact that it is CXF 2.7.3 and as far as
I recall CXF 2.7.3 was not able to process Jackson 2.x complex
inheritance structure.
I guess a Jackson version may have been changed ? I think updating CXF
version to 2.7.15 should do it.
Ron, FYI, Freeman introduced a CXF SwaggerFeature and Andriy Redko has
worked on enhancing it further and creating a demo,
https://git-wip-us.apache.org/repos/asf?p=cxf.git;a=tree;f=distribution/src/main/release/samples/jax_rs/description_swagger
This feature works by adding an endpoint or, alternatively, a Swagger
aware JAX-RS filter
Cheers, Sergey
On 13/03/15 09:20, Aki Yoshida wrote:
This is likely caused by the missing json provider in the
jaxrs.providers list, e.g. in web.xml
<init-param>
<param-name>jaxrs.providers</param-name>
<param-value>com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider</param-value>
</init-param>
or some dependency is missing.
I'll look at your sample.
regards, aki
2015-03-12 20:06 GMT+01:00 Ron Ratovsky <[email protected]>:
Greetings!
As part of the work we do with Swagger, we provide samples of integration
with various JAX-RS frameworks, including CXF.
In our last release, something broke with our CXF sample and we can't find
the way to solve it properly. The code base for the sample is similar all
across our samples and it's a basic pet store application. The problem is
when calling the API endpoints requesting application/json, we get the
message "No message body writer has been found for response class Pet.". It
works well for xml.
The odd part is that we didn't change anything with the code regarding the
CXF integration and the only difference was the upgrade of our own library.
Switching to an older version of our library seems to fix the problem. We
do include our own provider as well, but as far as I recall that hasn't
changed between versions.
I would appreciate it if anyone has the time and can look into this
project. The README explains how to easily run it. Once it's running,
executing http://localhost:8002/api/pet/1 with the application/json mime
type would exhibit the problem.
The project is located at
https://github.com/swagger-api/swagger-core/tree/develop_2.0/samples/java-jaxrs-cxf
(note this is the develop_2.0 branch, if you clone it, though the problem
exists in master as well).
Otherwise, if anyone has any suggestions what to look into or what other
information to provide, please let me know.
Thanks for the help,
Ron
--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------