Who would have thought the solution would be to just upgrade CXF. Thank you very much for the info!
I'll have to take a look at the SwaggerFeature you referred to. For now we're trying to document how to use Swagger without vendor-specific implementations but I'm very happy to see that those exist. BR, Ron On Fri, Mar 13, 2015 at 8:03 AM, Sergey Beryozkin <[email protected]> wrote: > Hi Aki > > Thanks a million for spending your time on validating it :-), > > Cheers, Sergey > > > On 13/03/15 11:16, Aki Yoshida wrote: > >> hi sergey, ron, >> think it's working with that change. >> regards, aki >> >> 2015-03-13 11:33 GMT+01:00 Aki Yoshida <[email protected]>: >> >>> Hi Sergey, >>> thanks the info ;-) >>> I saw com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider is loaded >>> but not selected as candidates during the matching process. >>> See if switching to 2.7.15 does the work. >>> regards, aki >>> >>> >>> 2015-03-13 11:16 GMT+01:00 Sergey Beryozkin <[email protected]>: >>> >>>> 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 >>>>>> ----------------------------------------- >>>>>> >>>>> >>>> >>>> > -- ----------------------------------------- http://swagger.io https://twitter.com/SwaggerApi -----------------------------------------
