Ron Need help with CXF Implementation with Swagger! (Empty API Listing)

104 views
Skip to first unread message

Guru Yeshwanth

unread,
Jul 27, 2015, 9:10:25 AM7/27/15
to Swagger
Hello Ron,

Please help me out resolve this issues I have made this post earlier but I think you thought this was a common issue but I could not find anything similar to that using CXF and Spring.



<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<display-name>Archetype Created Web Application</display-name>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/rest-servlet.xml</param-value>
</context-param>

<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>

and below is my application context class.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>


<!--<context:component-scan base-package="com.yesh.mps.benefits.apachepoc.service" />-->

<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>


<jaxrs:server id="accountrs" address="/rservice">
<jaxrs:serviceBeans>
<ref bean="accountService"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean='jsonProvider' />
</jaxrs:providers>
</jaxrs:server>

<bean id="accountService" class="com.yesh.mps.benefits.apachepoc.service.BenifitService" init-method="init"></bean>
<bean id="jsonProvider"
class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>



<jaxrs:server address="/sw" id="swagger">
<jaxrs:serviceBeans>
<ref bean="swaggerResourceJSON" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="resourceWriter" />
<ref bean="apiWriter" />
</jaxrs:providers>
</jaxrs:server>

<!-- CXF Config -->
<bean id="swaggerResourceJSON"
class="com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON" />
<bean id="resourceWriter"
class="com.wordnik.swagger.jaxrs.listing.ResourceListingProvider" />
<bean id="apiWriter"
class="com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider" />


<bean id="swaggerConfig" class="com.wordnik.swagger.jaxrs.config.BeanConfig">
<property name="resourcePackage" value="com.yesh.mps.benefits.apachepoc.service" />
<property name="version" value="2.0" />
<property name="basePath" value="http://localhost:8080/apache-poccxf-1.0-SNAPSHOT/sw" />
<property name="title" value="Swagger UI Integration Sample" />
<property name="description"
value="Swagger UI Integration Sample for demonstrating its working." />
<property name="contact" value="us...@gmail.com" />
<property name="scan" value="true" />
</bean>



</beans>

I am able to deploy the application to JBOSS but I am not able to fetch the List of API it always comes back with the same generic response.

{"apiVersion":"2.0","swaggerVersion":"1.2","info":{"title":"Swagger UI Integration Sample","description":"Swagger UI Integration Sample for demonstrating its working.","contact":"us...@gmail.com"}}

Please help me out.

Regards,
Guru

Ron Ratovsky

unread,
Aug 3, 2015, 11:16:08 AM8/3/15
to Swagger
Guru,

You're using an old version of swagger-core. Please upgrade to the latest version. The wiki has details on migration and the samples have updated samples.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Sampada Wagde

unread,
Feb 16, 2016, 5:21:51 AM2/16/16
to Swagger
Try using io.swagger instead of com.wordnik
Reply all
Reply to author
Forward
0 new messages