Hi Sergey,
sorry for the mistake :-)!
Following your suggestion, now it works!
But is there the same problem for the ServiceBean?
Until now I'm using:
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setServiceBean(implementor);
sf.setServiceBean(new ApiListingResourceJSON());
and not a list of serviceBean, but it seems to work right.
Thanks for the providential help,
Andrea
Date: Fri, 7 Jun 2013 03:32:37 -0700
From: [email protected]
To: [email protected]
Subject: Re: CXF and swagger
Hi
On 07/06/13 10:44, eanbiso wrote:
Hi Jersey,
You meant CXF :-) ?
the project
https://github.com/wordnik/swagger-core/tree/develop-1.3/samples/java-jaxrs-cxf
works for me (with this shrewdness: from swagger u.i when you put the address
http://localhost:8002/api/api-docs.json you must remove the .json from it,
otherwise it does not work).
I try to do the same, publishing an endPoint from java code (take a look at the code of
attached file "classExample.java" that publishes only the pet endPoint),
but when I call:
http://localhost:8002/api/api-docs
from swagger u.i this error is shown:
No message body writer has been found for response class ResourceListing.
This should occur because when we arrive in the method
private void serializeMessage(Message message,
Response response,
OperationResourceInfo ori,
boolean firstTry)
of JAXRSOutInterceptor class
the availableContentTypes is: [application/json, application/json;q=0.01]
while the message is a
org.apache.cxf.message.XMLMessage
so that the List<WriterInterceptor> writers is null and no messageBodyWriter
are attached...
On the other hand, if I use the swagger u.i with
http://localhost:8002/api/api-docs.json
an exception
java.lang.NoSuchMethodError
occurs in the JAXRSInInterceptor even before arriving in the ApiListing class
of swagger (this because with .json class we have a mismatch with the path of
the api, I think).
How can I solve this problem?
I see now, you call setProvider() and that method actually does not
accumulate them, so you have 4 calls, only the last provider gets added.
I'll need to fix that, I see it can be a source of the confusion, please
use setProviders method accepting a List
Thanks, Sergey
Thanks a lot for the help,
Andrea
Date: Fri, 7 Jun 2013 02:12:14 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: CXF and swagger
Hi Andrea
On 07/06/13 07:37, eanbiso wrote:
I attach also the pom.xml file with required jar of the project (if it was
more useful)...
it is the pom.xml file of the example at:
https://github.com/wordnik/swagger-core/tree/develop-1.3/samples/java-jaxrs-cxf
that I've tried to replicate in mine project...
pom.xml <http://cxf.547215.n5.nabble.com/file/n5728895/pom.xml>
I can give it a go and experiment with the actual project at
https://github.com/wordnik/swagger-core/tree/develop-1.3/samples/java-jaxrs-cxf
Can you tell me please, does that original project work for you ?
Thanks, Sergey
Andrea
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-and-swagger-tp5728644p5728895.html
Sent from the cxf-user mailing list archive at Nabble.com.