javaworkinggirl, I have to correct what I said before regarding the jackson version and you are right. I just checked cxf 3.1.x and 3.2.x's samples. They are picking some mismatched jackson dependency. I'll update them shortly and also add a plain spring version of it (although we thought that would not be necessary because all you need is to take the description_swagger2_web's spring xml and change the endpoint url and just load the file using the spring context loader, having a sample is probably helpful). regards, aki
2016-06-05 23:00 GMT+02:00 Aki Yoshida <[email protected]>: > regarding your jackson version issue, CXF's samples should be all > running with the jackson version that are automatically picked up, > which is some 2.4.x. version. > And current swagger-core 1.5.9 itself is built with jackson 2.4.5. > > So if your code is complaining about jackson version and upgrading it > to the 2.7.4 version which is not even used in swagger, it has to > something to do with your own jackson usage. Probably you had a > mixture of old and new versions and the new one was picking up some > classes from the older one and hitting the NoSuchMethodError > > regards, aki > > > 2016-06-02 20:38 GMT+02:00 javaworkinggirl <[email protected]>: >> I upgraded jackson to get the sample to work. >> >> <dependency> >> <groupId>com.fasterxml.jackson.jaxrs</groupId> >> <artifactId>jackson-jaxrs-json-provider</artifactId> >> <version>2.7.4</version> >> </dependency> >> <dependency> >> <groupId>com.fasterxml.jackson.core</groupId> >> <artifactId>jackson-core</artifactId> >> <version>2.7.4</version> >> </dependency> >> >> >> On Thu, Jun 2, 2016 at 11:09 AM, Tara Czutno <[email protected]> >> wrote: >> >>> In the description_swagger2 project I followed the Readme.txt. >>> This worked: >>> >>> mvn install >>> mvn -Pserver >>> >>> >>> But none of these links worked: >>> >>> http://localhost:9000/swagger.json >>> http://localhost:9000/swagger.yaml >>> >>> http://localhost:9000/?url=/swagger.json >>> >>> http://localhost:9000/?url=/swagger.yaml >>> >>> >>> Got: >>> >>> Can't read from server. It may not have the appropriate >>> access-control-origin settings. >>> >>> And this was in the logs: >>> >>> Jun 02, 2016 11:05:03 AM org.apache.cxf.common.logging.LogUtils doLog >>>> >>>> WARNING: Interceptor for {http://server.swagger.jaxrs.demo/}Sample has >>>> thrown exception, unwinding now >>>> >>>> org.apache.cxf.interceptor.Fault: >>>> com.fasterxml.jackson.databind.JavaType.isReferenceType()Z >>>> >>>> at >>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleWriteException(JAXRSOutInterceptor.java:391) >>>> >>>> at >>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:266) >>>> >>>> at >>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:120) >>>> >>>> at >>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:83) >>>> >>>> at >>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) >>>> >>>> at >>>> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83) >>>> >>>> at >>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) >>>> >>>> at >>>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) >>>> >>>> at >>>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:299) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:223) >>>> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) >>>> >>>> at >>>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:274) >>>> >>>> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821) >>>> >>>> at >>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) >>>> >>>> at >>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) >>>> >>>> at >>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) >>>> >>>> at >>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) >>>> >>>> at >>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) >>>> >>>> at >>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) >>>> >>>> at org.eclipse.jetty.server.Server.handle(Server.java:517) >>>> >>>> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306) >>>> >>>> at >>>> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) >>>> >>>> at >>>> org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261) >>>> >>>> at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) >>>> >>>> at >>>> org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) >>>> >>>> at >>>> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) >>>> >>>> at >>>> org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) >>>> >>>> at >>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) >>>> >>>> at >>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) >>>> >>>> at java.lang.Thread.run(Thread.java:745) >>>> >>>> Caused by: java.lang.NoSuchMethodError: >>>> com.fasterxml.jackson.databind.JavaType.isReferenceType()Z >>>> >>>> at >>>> com.fasterxml.jackson.databind.ser.BasicSerializerFactory.findSerializerByLookup(BasicSerializerFactory.java:302) >>>> >>>> at >>>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory._createSerializer2(BeanSerializerFactory.java:218) >>>> >>>> at >>>> com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:153) >>>> >>>> at >>>> com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1203) >>>> >>>> at >>>> com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1157) >>>> >>>> at >>>> com.fasterxml.jackson.databind.SerializerProvider.findValueSerializer(SerializerProvider.java:481) >>>> >>>> at >>>> com.fasterxml.jackson.databind.SerializerProvider.findTypedValueSerializer(SerializerProvider.java:679) >>>> >>>> at >>>> com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:107) >>>> >>>> at >>>> com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3559) >>>> >>>> at >>>> com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:2927) >>>> >>>> at >>>> io.swagger.jaxrs.listing.SwaggerSerializers.writeTo(SwaggerSerializers.java:52) >>>> >>>> at >>>> org.apache.cxf.jaxrs.swagger.Swagger2Serializers.writeTo(Swagger2Serializers.java:145) >>>> >>>> at >>>> org.apache.cxf.jaxrs.swagger.Swagger2Serializers.writeTo(Swagger2Serializers.java:49) >>>> >>>> at >>>> org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1380) >>>> >>>> at >>>> org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:244) >>>> >>> >>> >>> >>> >>> On Thu, Jun 2, 2016 at 10:33 AM, Tara Czutno <[email protected]> >>> wrote: >>> >>>> Okay I will try that. >>>> >>>> On Thu, Jun 2, 2016 at 10:32 AM, Aki Yoshida-3 [via CXF] < >>>> [email protected]> wrote: >>>> >>>>> hi, >>>>> those swagger2 samples included in cxf's samples include README.txt >>>>> explaining how you can try them out. >>>>> In short, both description_swagger2 and description_swagger2_web are >>>>> the standalone/embedded-jetty and web-container samples and both >>>>> deploy the swagger-ui with the sample apps. description_swagger2_osgi >>>>> is an osgi bundle that doesn't include the swagger-ui. You can use >>>>> swagger-ui from elsewhere (e.g., from one of the other samples or from >>>>> a local file system). >>>>> regards, aki >>>>> >>>>> 2016-06-02 11:24 GMT+02:00 Sergey Beryozkin <[hidden email] >>>>> <http:///user/SendEmail.jtp?type=node&node=5769226&i=0>>: >>>>> >>>>> > Hi >>>>> > >>>>> > I believe one needs to add Swagger UI, Aki Youshida added 3 Swagger 2 >>>>> demos, >>>>> > see this directory: >>>>> > >>>>> > >>>>> https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs >>>>> > >>>>> > Can you please try one of them ? >>>>> > >>>>> > Actually, I've just tried >>>>> > >>>>> https://github.com/apache/cxf/tree/master/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot >>>>> > >>>>> > which creates a CXFServlet with a URI "/services/helloworld/*" pattern >>>>> > and registers the feature at >>>>> > >>>>> https://github.com/apache/cxf/blob/master/distribution/src/main/release/samples/jax_rs/jaxrs_spring_boot/src/main/java/sample/rs/service/SampleRestApplication.java#L49 >>>>> > >>>>> > and >>>>> > >>>>> > http://localhost:8080/services/helloservice/swagger.json >>>>> > >>>>> > returns JSON, >>>>> > >>>>> > http://localhost:8080/services/helloservice/swagger.yaml >>>>> > >>>>> > return Yaml. >>>>> > >>>>> > but I guess having UI on top of it would be good, so please Aki's >>>>> demo's >>>>> > (pom.xml) on how to wire Swagger UI in >>>>> > >>>>> > HTH, Sergey >>>>> > >>>>> > >>>>> > >>>>> > On 01/06/16 21:21, javaworkinggirl wrote: >>>>> >> >>>>> >> Okay I got my code to compile and run with Swagger2Feature, but I >>>>> don't >>>>> >> see >>>>> >> any swagger files being generated. Where are they supposed to be >>>>> >> generated >>>>> >> at? Does Swagger2Feature log any status? >>>>> >> >>>>> >> <!-- CXF Swagger2Feature --> >>>>> >> <bean id="swagger2FeatureWebServices" >>>>> >> class="org.apache.cxf.jaxrs.swagger.Swagger2Feature"> >>>>> >> <property name="basePath" value="/api"/> >>>>> >> <property name="contact" value="[hidden email] >>>>> <http:///user/SendEmail.jtp?type=node&node=5769226&i=1>"/> >>>>> >> <property name="description" value="xyz REST Services"/> >>>>> >> <property name="host" value="0.0.0.0"/> >>>>> >> <property name="prettyPrint" value="false"/> >>>>> >> <property name="resourcePackage" >>>>> >> value="com.twc.ctg.xyz.service.rest"/> >>>>> >> <property name="title" value="xyz REST Services"/> >>>>> >> </bean> >>>>> >> >>>>> >> >>>>> >> <!-- Depends on activemq due to tvod vendor rest service using amqp >>>>> to >>>>> >> send notifications --> >>>>> >> <!-- This endpoint scans our rest.custom directory for Providers, >>>>> >> NameBindings etc. --> >>>>> >> <jaxrs:server id="ecpWebServices" >>>>> >> basePackages="com.twc.ctg.ecp.service.rest.custom" >>>>> >> address="http://0.0.0.0:8877" >>>>> depends-on="activeMQConnectionFactory"> >>>>> >> <jaxrs:inInterceptors> >>>>> >> <ref bean="validationInInterceptor"/> >>>>> >> </jaxrs:inInterceptors> >>>>> >> <jaxrs:outInterceptors> >>>>> >> <ref bean="validationOutInterceptor"/> >>>>> >> </jaxrs:outInterceptors> >>>>> >> <jaxrs:serviceBeans> >>>>> >> <ref bean="ecpAdminRestServiceV1"/> >>>>> >> <ref bean="ecpApplicationRestServiceV1"/> >>>>> >> <ref bean="ecpEntitlementRestServiceV2"/> >>>>> >> <ref bean="ecpTvodRestServiceV1"/> >>>>> >> <ref bean="ecpHouseholdHistoryRestServiceV1"/> >>>>> >> <ref bean="ecpPromotionRestServiceV1"/> >>>>> >> <ref bean="ecpTvodPromotionServiceV1"/> >>>>> >> <ref bean="ecpFeatureRestServiceV1"/> >>>>> >> <ref bean="ecpPpvServiceV1"/> >>>>> >> </jaxrs:serviceBeans> >>>>> >> <jaxrs:providers> >>>>> >> <bean >>>>> >> class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/> >>>>> >> <bean >>>>> >> >>>>> class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/> >>>>> >> <ref bean="genericRestExceptionMapper"/> >>>>> >> <ref bean="customValidationExceptionMapper"/> >>>>> >> </jaxrs:providers> >>>>> >> <jaxrs:features> >>>>> >> <ref bean="swagger2FeatureWebServices" /> >>>>> >> </jaxrs:features> >>>>> >> </jaxrs:server> >>>>> >> >>>>> >> >>>>> >> >>>>> >> >>>>> >> On Wed, Jun 1, 2016 at 2:38 AM, Sergey Beryozkin [via CXF] < >>>>> >> [hidden email] >>>>> <http:///user/SendEmail.jtp?type=node&node=5769226&i=2>> wrote: >>>>> >> >>>>> >>> Hi >>>>> >>> >>>>> >>> I'll be moving it into a dedicated module in 3.2.0-SNAPSHOT, the >>>>> current >>>>> >>> module has both WADL and Swagger code >>>>> >>> >>>>> >>> Cheers, Sergey >>>>> >>> On 01/06/16 00:35, Benson Margulies wrote: >>>>> >>> >>>>> >>>> Somewhere in >>>>> >>>> >>>>> >>>> >>>>> >>>> [INFO] >>>>> >>> >>>>> >>> org.apache.cxf:cxf-rt-rs-service-description:jar:3.1.4:provided >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> >>>>> >>>> On Tue, May 31, 2016 at 7:31 PM, javaworkinggirl >>>>> >>>> <[hidden email] < >>>>> http:///user/SendEmail.jtp?type=node&node=5769172&i=0>> >>>>> >>> >>>>> >>> wrote: >>>>> >>>>> >>>>> >>>>> Which jar? >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> View this message in context: >>>>> >>> >>>>> >>> >>>>> >>> >>>>> http://cxf.547215.n5.nabble.com/Swagger2Feature-jar-and-version-tp5769165p5769167.html >>>>> >>>>> >>>>> >>>>> Sent from the cxf-user mailing list archive at Nabble.com. >>>>> >>> >>>>> >>> >>>>> >>> >>>>> >>> >>>>> >>> ------------------------------ >>>>> >>> If you reply to this email, your message will be added to the >>>>> discussion >>>>> >>> below: >>>>> >>> >>>>> >>> >>>>> >>> >>>>> http://cxf.547215.n5.nabble.com/Swagger2Feature-jar-and-version-tp5769165p5769172.html >>>>> >>> To unsubscribe from Swagger2Feature jar and version, click here >>>>> >>> >>>>> >>> < >>>>> >>> . >>>>> >>> NAML >>>>> >>> >>>>> >>> < >>>>> http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >>>>> >>>>> >>> >>>>> >> >>>>> >> >>>>> >> >>>>> >> >>>>> >> -- >>>>> >> View this message in context: >>>>> >> >>>>> http://cxf.547215.n5.nabble.com/Swagger2Feature-jar-and-version-tp5769165p5769200.html >>>>> >> Sent from the cxf-user mailing list archive at Nabble.com. >>>>> >> >>>>> > >>>>> >>>>> >>>>> ------------------------------ >>>>> If you reply to this email, your message will be added to the discussion >>>>> below: >>>>> >>>>> http://cxf.547215.n5.nabble.com/Swagger2Feature-jar-and-version-tp5769165p5769226.html >>>>> To unsubscribe from Swagger2Feature jar and version, click here >>>>> <http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5769165&code=amF2YXdvcmtpbmdnaXJsQGdtYWlsLmNvbXw1NzY5MTY1fC0xMTE1Njg5NTY4> >>>>> . >>>>> NAML >>>>> <http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >>>>> >>>> >>>> >>> >> >> >> >> >> -- >> View this message in context: >> http://cxf.547215.n5.nabble.com/Swagger2Feature-jar-and-version-tp5769165p5769237.html >> Sent from the cxf-user mailing list archive at Nabble.com.
