Swagger integration with existing Apache Wink application

722 views
Skip to first unread message

Kapil Sharma

unread,
Jul 31, 2014, 1:27:36 PM7/31/14
to swagger-sw...@googlegroups.com
I am following this tutorial to integrate existing apache wink restful web service with Swagger. I am getting below exception, not sure what could be the cause. Can someone point me to a good direction?

Exception:
[7/31/14 12:11:12:953 CDT] 00000058 ApplicationMg A   WSVR0220I: Application stopped: MVIServiceEAR
[7/31/14 12:11:12:954 CDT] 00000058 CompositionUn E   WSVR0194E: Composition unit WebSphere:cuname=MVIServiceEAR in BLA WebSphere:blaname=MVIServiceEAR failed to start.
[7/31/14 12:11:12:984 CDT] 00000058 FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\IBM\WebSphere\AppServer\profiles\AppSrvJDK7\logs\ffdc\server1_c7264395_14.07.31_12.11.12.9553143471451382488154.txt com.ibm.ws.runtime.component.CompositionUnitMgrImpl 679
[7/31/14 12:11:12:996 CDT] 00000058 FfdcProvider  W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC Incident emitted on C:\IBM\WebSphere\AppServer\profiles\AppSrvJDK7\logs\ffdc\server1_c7264395_14.07.31_12.11.12.9868319985569632067857.txt com.ibm.ws.management.application.AppManagementImpl.startApplication 1500
[7/31/14 12:11:12:996 CDT] 00000058 AppManagement W   ADMA0116W: Unable to start: MVIServiceEAR using: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=CV11683Node02,version=8.5.0.2,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=CV11683Node02Cell,spec=1.0 exception is: javax.management.MBeanException: Exception thrown in RequiredModelMBean while trying to invoke operation startApplication
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1299)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1088)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:831)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:804)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at com.ibm.ws.management.application.AppManagementImpl._startApplication(AppManagementImpl.java:1482)
at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1371)
at com.ibm.ws.management.application.AppManagementImpl.startApplication(AppManagementImpl.java:1320)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:287)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1256)
at java.security.AccessController.doPrivileged(AccessController.java:252)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1250)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1088)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:831)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:804)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:478)
at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:314)
at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:65)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:733)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:532)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
Caused by: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Provider for javax.xml.transform.TransformerFactory cannot be found
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5369)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5585)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:287)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1256)
at java.security.AccessController.doPrivileged(AccessController.java:252)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1250)
... 40 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Provider for javax.xml.transform.TransformerFactory cannot be found
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
... 73 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Provider for javax.xml.transform.TransformerFactory cannot be found
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
... 75 more
Caused by: javax.xml.transform.TransformerFactoryConfigurationError: Provider for javax.xml.transform.TransformerFactory cannot be found
at javax.xml.transform.TransformerFactory.newInstance(Unknown Source)
at org.apache.wink.common.internal.providers.entity.SourceProvider.<clinit>(SourceProvider.java:74)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:203)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.scanForHandlesTypesClasses(WebAppImpl.java:804)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
... 76 more

My web.xml file:
<servlet>
<servlet-name>restSdkService</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>restSdkService</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

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

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/server/wink-core-context.xml
        classpath:mvis_spring.xml
        </param-value>
</context-param>

<servlet>
<servlet-name>SwaggerJaxrsConfig</servlet-name>
<servlet-class>com.cars.service.swagger.SwaggerJaxrsConfig</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>

SwaggerJaxrsConfig Servlet:
public class SwaggerJaxrsConfig extends HttpServlet {
private static final Logger LOGGER = LoggerFactory
.getLogger(SwaggerJaxrsConfig.class);

private static final long serialVersionUID = 6599857044839801800L;

@Override
public void init(ServletConfig servletConfig) {
try {
super.init(servletConfig);
SwaggerConfig swaggerConfig = new SwaggerConfig();
ConfigFactory.setConfig(swaggerConfig);
swaggerConfig.setBasePath("http://localhost:9081/swagger/rest");
swaggerConfig.setApiVersion("1.0");
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new DefaultJaxrsApiReader());
} catch (Exception e) {
LOGGER.error("Failed to configure swagger", e);
}
}
}


ApplicationConfig Class:
@ApplicationPath("rest")
public class ApplicationConfig extends Application{
@Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new java.util.HashSet<>();
        resources.add(com.wordnik.swagger.jaxrs.listing.ApiListingResource.class);        
        resources.add(com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider.class);
        resources.add(com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON.class);
        resources.add(com.wordnik.swagger.jaxrs.listing.ResourceListingProvider.class);
        //addRestResourceClasses(resources);
        return resources;
    }

    /**
     * Do not modify addRestResourceClasses() method.
     * It is automatically populated with
     * all resources defined in the project.
     * If required, comment out calling this method in getClasses().
     */
    private void addRestResourceClasses(Set<Class<?>> resources) {
        //resources.add(com.example.rest.hello.HelloResource.class);
    }

}



Ron

unread,
Jul 31, 2014, 1:48:16 PM7/31/14
to swagger-sw...@googlegroups.com
Are you sure the issue is related to Swagger? There's nothing in the logs indicating it.
Were you able to run the application before adding Swagger to it? If you didn't try, can you try removing Swagger and checking?




--
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.

Kapil Sharma

unread,
Jul 31, 2014, 3:52:35 PM7/31/14
to swagger-sw...@googlegroups.com
Thanks Ron, Yes, I am able to run the service before running the swagger.I did a further digging. The issue happens as soon as I add swagger annotations e.g. @Api(value = "servicename", description = "Operations to get the service Data") and @ApiOperation(value = "Find data by given criteria", notes = "This operation provides the  data in the json format as per the the provided criteria", response = MyResponse.class).
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron

unread,
Jul 31, 2014, 4:14:00 PM7/31/14
to swagger-sw...@googlegroups.com
Assuming this is a maven-based project, can you attach the output of 'mvn dependency:tree'?


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Kapil Sharma

unread,
Jul 31, 2014, 4:29:27 PM7/31/14
to swagger-sw...@googlegroups.com
Below is my maven dependencies:

<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>${backport.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.8.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${codehaus.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>${codehaus.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${codehaus.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>${codehaus.jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.2.0.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>${aopalliance.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>${wink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-common</artifactId>
<version>${wink.version}</version>
<exclusions>
<exclusion>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
</exclusion>
<exclusion>
<artifactId>jaxb-impl</artifactId>
<groupId>com.sun.xml.bind</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-json-provider</artifactId>
<version>${wink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-spring-support</artifactId>
<version>${wink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wink</groupId>
<artifactId>wink-server</artifactId>
<version>${wink.version}</version>
<exclusions>
<exclusion>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
</exclusion>
<exclusion>
<artifactId>jaxb-impl</artifactId>
<groupId>com.sun.xml.bind</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.com.robust-it</groupId>
<artifactId>cloning</artifactId>
<version>1.9.0</version>
</dependency>
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron

unread,
Jul 31, 2014, 4:33:25 PM7/31/14
to swagger-sw...@googlegroups.com
There's something weird going on here.
The exception you see is

Caused by: javax.xml.transform.TransformerFactoryConfigurationError: Provider for javax.xml.transform.TransformerFactory cannot be found

Which for the moment I can't see how it's related to Swagger (notice that there's no mention of Swagger in the log).
Based on http://www-01.ibm.com/support/docview.wss?uid=swg21661696 this could be some kind of a dependency issue which is why I asked for 'mvn dependency:tree' and not just the list of dependencies.
Something that's being pulled in (or not pulled in) can be the cause of it.


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Kapil Sharma

unread,
Jul 31, 2014, 5:40:10 PM7/31/14
to swagger-sw...@googlegroups.com
Below is the dependency tree from maven

0.M2/aether-util-0.9.0.M2.jar (131 KB at 261.4 KB/sec)
[INFO] com.service.data:war:1.0.0
[INFO] +- org.aspectj:aspectjrt:jar:1.6.12:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.6.12:compile
[INFO] +- backport-util-concurrent:backport-util-concurrent:jar:3.0:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] +- commons-collections:commons-collections:jar:3.2:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- com.wordnik:swagger-jaxrs_2.10:jar:1.3.7:compile
[INFO] |  +- org.scala-lang:scala-library:jar:2.10.0:compile
[INFO] |  +- com.wordnik:swagger-core_2.10:jar:1.3.7:compile
[INFO] |  |  +- com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.4.1:compile
[INFO] |  |  |  +- org.scala-lang:scala-reflect:jar:2.10.4:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.4.1.1:compile
[INFO] |  |  |  +- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
[INFO] |  |  |  \- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.4.1:compile
[INFO] |  |  +- com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.1.0:compile
[INFO] |  |  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.0.0:compile
[INFO] |  |  |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.0.0:compile
[INFO] |  |  +- com.wordnik:swagger-annotations:jar:1.3.7:compile
[INFO] |  |  +- org.json4s:json4s-ext_2.10:jar:3.2.9:compile
[INFO] |  |  |  +- joda-time:joda-time:jar:2.3:compile
[INFO] |  |  |  \- org.joda:joda-convert:jar:1.6:compile
[INFO] |  |  +- org.json4s:json4s-native_2.10:jar:3.2.9:compile
[INFO] |  |  |  \- org.json4s:json4s-core_2.10:jar:3.2.9:compile
[INFO] |  |  |     +- org.json4s:json4s-ast_2.10:jar:3.2.9:compile
[INFO] |  |  |     \- org.scala-lang:scalap:jar:2.10.0:compile
[INFO] |  |  |        \- org.scala-lang:scala-compiler:jar:2.10.0:compile
[INFO] |  |  \- org.json4s:json4s-jackson_2.10:jar:3.2.9:compile
[INFO] |  +- javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO] |  \- org.reflections:reflections:jar:0.9.9-RC1:compile
[INFO] |     +- com.google.guava:guava:jar:11.0.2:compile
[INFO] |     +- org.javassist:javassist:jar:3.16.1-GA:compile
[INFO] |     \- dom4j:dom4j:jar:1.6.1:compile
[INFO] |        \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.apache.commons:commons-dbcp2:jar:2.0.1:compile
[INFO] |  \- org.apache.commons:commons-pool2:jar:2.2:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.5.6:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.4:test
[INFO] +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile
[INFO] +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile
[INFO] +- org.codehaus.jackson:jackson-xc:jar:1.9.2:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.2.6:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.1.4:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- log4j:log4j:jar:1.2.16:compile
[INFO] +- com.oracle:ojdbc5:jar:11.2.0.1.0:compile
[INFO] +- org.springframework:spring-aop:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-instrument:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.11:compile
[INFO] +- org.slf4j:slf4j-simple:jar:1.5.11:compile
[INFO] +- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.apache.wink:wink-client:jar:1.3.0:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.apache.wink:wink-common:jar:1.3.0:compile
[INFO] |  \- org.apache.geronimo.specs:geronimo-annotation_1.1_spec:jar:1.0:compile
[INFO] +- org.apache.wink:wink-json-provider:jar:1.3.0:compile
[INFO] |  \- org.json:json:jar:20080701:compile
[INFO] +- org.apache.wink:wink-spring-support:jar:1.3.0:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile
[INFO] +- org.apache.wink:wink-server:jar:1.3.0:compile
[INFO] |  \- commons-lang:commons-lang:jar:2.3:compile
[INFO] +- org.springframework:spring-test:jar:3.1.2.RELEASE:test
[INFO] \- uk.com.robust-it:cloning:jar:1.9.0:compile
[INFO]    \- org.objenesis:objenesis:jar:1.2:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.641 s
[INFO] Finished at: 2014-07-31T16:36:31-06:00
[INFO] Final Memory: 16M/223M
[INFO] ------------------------------------------------------------------------
...

Kapil Sharma

unread,
Jul 31, 2014, 6:49:54 PM7/31/14
to swagger-sw...@googlegroups.com
Now, I deployed the same webservice to Tomact 7.0.55. The service seems to be fine, no error messages but when I invoke the URL I get the empty response.


The swagger base path has been set up to swaggerConfig.setBasePath("http://localhost:8080/service/rest/swagger");

my ApplicationConfig class has application path as @ApplicationPath("swagger")

Any help will be highly appreciated.
[INFO] |  |  |<span style="color: #000
...

Ron

unread,
Aug 2, 2014, 7:32:14 AM8/2/14
to swagger-sw...@googlegroups.com
Hi Kapil,

If the same application works properly under Tomcat but not under WebSphere, then this is an issue with the WAS which unfortunately I won't be able to help with as I don't have access to it (being a commercial product),
It's possible there's an issue with classloading, and possibly the distribution of shared libraries. It's quite possible that swagger-core has nothing to do with it and adding it (much like possibly any other library) has triggered the change in classloading.

As for running it on tomcat, the swagger base path has nothing to do with where your api-docs are hosted. They'd be hosted directly under the path exposing your API.
In your case (based on the previously shared web.xml), it should be http://localhost:8080/service/rest/api-docs.
Please let me know if that works for you.


--

Kapil Sharma

unread,
Aug 5, 2014, 5:37:44 PM8/5/14
to swagger-sw...@googlegroups.com
Hi Ron,

I appreciate your help very much. What I meant was in Tomcat I didn't find any startup error logs when I deployed the application in tomcat. After struggling thru the configurations, I finally got it somewhat working in tomcat (I am not using websphere anymore). But the /api-docs returns only partial response. Which is shown below

{"apiVersion":"1.0","swaggerVersion":"1.2","apis":[{"path":"/listings","description":"The API lists all the operations related to search"}],"info":{"title":"Search Service","description":"This is search service app.","contact":"xx...@xxx.com","license":"Apache 2.0 License","licenseUrl":"http://www.apache.org/licenses/LICENSE-2.0.html"}}

So it shows what I provided at the Resource level but  (@ApiOperation) is not being picked. I think I am missing a very small setting. Below a sample code of my resource class:

@Path("listings")

@Api(value = "modelListings", description = "The API lists all the operations related to search")

public class ModelListingsResource {
 
@GET
 
@Path("list/{pathparam1}/{pathparam2}/json")
 
@Produces(MediaType.APPLICATION_JSON)
 
@ApiOperation(httpMethod = "GET", value = "Find listings by given criteria", notes = "This operation provides the listing data in the json format as per the the provided criteria", response = Result.class, nickname="list/{param1}/{param2}/json")
 
public Result getJSONListings(
 
@ApiParam(value = "Path parameter for the 1st category ", required = true) @PathParam(param1) String param1,
 
@ApiParam(value = "Path parameter for the 2nd category, required = true) @PathParam("param2") String param2,
 @ApiParam(value = "
query parameter for the primary sort field", required = false)  @QueryParam("sf1")  String sf1) {
 return new Result();
 }


}


My web.xml looks something like this:
<servlet>
 
<servlet-name>restService</servlet-name>

 
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
 
<load-on-startup>0</load-on-startup>
 
</servlet>

 
<servlet-mapping>

 
<servlet-name>restService</servlet-name>

 
<url-pattern>/rest/*</url-pattern>
 
</servlet-mapping>

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

 
<context-param>
 
<param-name>contextConfigLocation</param-name>
 
<param-value>
classpath:META-INF/server/wink-core-context.xml
        classpath:spring.xml
       
</param-value>
 
</context-param>

spring.xml:
<bean class="com.service.spring.RegistrarWithSingletons">
<property name="instances">
<set>
<ref bean="serviceResource" />
<ref bean="swaggerApiListingResourceJSON" />
</set>
</property>
</bean>
<bean id="swaggerApiListingResourceJSON" class="com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON"></bean>
<!-- this scans the classes for resources -->
  <bean id="swaggerConfig" class="com.wordnik.swagger.jaxrs.config.BeanConfig">
    <property name="resourcePackage" value="com.service.resource"/>
    <property name="version" value="1.0"/>
    <property name="basePath" value="http://localhost:8080/service/rest"/>
    <property name="title" value="Model Listing App"/>
    <property name="description" value="This is MVIS app."/>
    <property name="contact" value="xyx...@xxx.com"/>
    <property name="license" value="Apache 2.0 License"/>
    <property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
    <property name="scan" value="true"/>
  </bean>

RegistrarWithSingletons.java
public class RegistrarWithSingletons extends Registrar {

@Override
public Set<Object> getSingletons() {
Set<Object> singletons = new HashSet<>();

ObjectMapper mapper = new ObjectMapper();
AnnotationIntrospector introspector = new JaxbAnnotationIntrospector();
AnnotationIntrospector jacksonIntrospector = new JacksonAnnotationIntrospector();
AnnotationIntrospector pair = new AnnotationIntrospector.Pair(
introspector, jacksonIntrospector);
mapper.getDeserializationConfig().withAnnotationIntrospector(pair);
mapper.getSerializationConfig().withAnnotationIntrospector(pair);

JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();

provider.setMapper(mapper);
singletons.add(provider);
singletons.add(new ApiDeclarationProvider());
singletons.add(new ResourceListingProvider());
return singletons;
}


-Kapil
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron

unread,
Aug 6, 2014, 10:09:04 AM8/6/14
to swagger-sw...@googlegroups.com
Actually, that looks fine.

Try adding "/listing" after your "/api-docs".
For example, if you browse to http://localhost:8080/myapp/api-docs, then instead go to http://localhost:8080/myapp/api-docs/listing

If you look at the output of /api-docs, you'll see an "apis" property which lists the resources available. In your case, it mentions "/listing".


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Kapil Sharma

unread,
Aug 6, 2014, 10:30:35 AM8/6/14
to swagger-sw...@googlegroups.com
Hi Ron,

Yes, you are right. It works fine. I hope the setup which I have mentioned above, helps rest of the folks who are trying to set up swagger with Wink.
[INFO] |  |  +- com.wordnik:swagger-annotations:jar:1.3.<span st
...

Ron

unread,
Aug 6, 2014, 10:34:06 AM8/6/14
to swagger-sw...@googlegroups.com
Glad to hear it all works out for you.
If you have any further questions, feel free to ask.


--

stacey o'neill

unread,
Aug 8, 2014, 1:21:59 PM8/8/14
to swagger-sw...@googlegroups.com
Do you know if it is possible to set up swagger with jax rs without the use of Maven? I have tried to set it up this way but I am getting a 405 when I try to hit my path. Im testing this out on a websphere process server 7.0. When I hit my basepath I get "can't read swagger JSON unable to load swaggerUI". Can you help with this?

Thanks
Hi Ron,

[INFO] |  |  <span style="color:#6
...

Ron

unread,
Aug 8, 2014, 2:24:30 PM8/8/14
to swagger-sw...@googlegroups.com

Of course it's possible, it just requires more manual work. Which JAX RS implementation do you use?

--

Mahesh Vipat

unread,
Nov 21, 2014, 11:46:35 AM11/21/14
to swagger-sw...@googlegroups.com
We do not use Maven, hence wanted a list of jars which we will need for this integration.


Ron

unread,
Nov 21, 2014, 11:52:03 AM11/21/14
to swagger-sw...@googlegroups.com
This should be the list:

[INFO]    com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO]    com.thoughtworks.paranamer:paranamer:jar:2.6:compile
[INFO]    org.scala-lang:scala-reflect:jar:2.10.3:compile
[INFO]    joda-time:joda-time:jar:2.3:compile
[INFO]    org.scala-lang:scala-compiler:jar:2.10.0:compile
[INFO]    commons-lang:commons-lang:jar:2.4:compile
[INFO]    org.json4s:json4s-ext_2.10:jar:3.2.9:compile
[INFO]    org.json4s:json4s-ast_2.10:jar:3.2.9:compile
[INFO]    org.scala-lang:scala-library:jar:2.10.0:compile
[INFO]    xml-apis:xml-apis:jar:1.0.b2:compile
[INFO]    com.wordnik:swagger-core_2.10:jar:1.3.10:compile
[INFO]    javax.ws.rs:jsr311-api:jar:1.1.1:compile
[INFO]    org.json4s:json4s-native_2.10:jar:3.2.9:compile
[INFO]    org.javassist:javassist:jar:3.16.1-GA:compile
[INFO]    org.scala-lang:scalap:jar:2.10.0:compile
[INFO]    org.reflections:reflections:jar:0.9.9-RC1:compile
[INFO]    com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.4.1:compile
[INFO]    com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.0.0:compile
[INFO]    org.json4s:json4s-jackson_2.10:jar:3.2.9:compile
[INFO]    com.fasterxml.jackson.core:jackson-databind:jar:2.4.1.1:compile
[INFO]    com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.0.0:compile
[INFO]    com.wordnik:swagger-annotations:jar:1.3.10:compile
[INFO]    com.fasterxml.jackson.module:jackson-module-jsonSchema:jar:2.1.0:compile
[INFO]    com.fasterxml.jackson.core:jackson-core:jar:2.4.1:compile
[INFO]    com.google.guava:guava:jar:11.0.2:compile
[INFO]    org.joda:joda-convert:jar:1.6:compile
[INFO]    com.fasterxml.jackson.core:jackson-annotations:jar:2.4.1:compile
[INFO]    dom4j:dom4j:jar:1.6.1:compile
[INFO]    org.slf4j:slf4j-api:jar:1.6.3:compile
[INFO]    org.json4s:json4s-core_2.10:jar:3.2.9:compile

On 21 November 2014 18:46, Mahesh Vipat <mvi...@gmail.com> wrote:
We do not use Maven, hence wanted a list of jars which we will need for this integration.


Anastasios Zouzias

unread,
Dec 5, 2014, 7:26:54 AM12/5/14
to swagger-sw...@googlegroups.com
Hi there,

I have created a simple maven project that integrates Apache Wink with Swagger. It is available below

https://github.com/zouzias/swagger-jaxrs-wink.git

Cheers
Anastasios

tony tam

unread,
Dec 5, 2014, 3:44:07 PM12/5/14
to swagger-sw...@googlegroups.com
Great!  Do you want to add this to swagger-core develop_scala-2.10 branch and send a pull request?  I'm sure others would like to have this in the core samples.

Anastasios Zouzias

unread,
Dec 6, 2014, 4:40:47 AM12/6/14
to swagger-sw...@googlegroups.com
Sure, I would love to do that.

I put it under develop_scala-2.10 if there is no develop_java-2.10 branch.

Anastasios

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/lpv7G13M-ow/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

Anastasios Zouzias

unread,
Dec 6, 2014, 5:30:21 AM12/6/14
to swagger-sw...@googlegroups.com
Hi Tony,

I submitted a pull request. Let me know if there is anything else needed for finalizing the merge, i.e., travis integration etc.

https://github.com/swagger-api/swagger-core/pull/780

Best,
Anastasios
--
Anastasios Zouzias
IBM Research Division - Zurich Research Laboratory
Saumerstrasse 4
8803 Ruschlikon - Switzerland
Email: a...@zurich.ibm.com

Tony Tam

unread,
Dec 8, 2014, 1:12:34 AM12/8/14
to swagger-sw...@googlegroups.com
Thanks, I’ll use that as a baseline and update it to the petstore project.

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.

Anastasios Zouzias

unread,
Dec 12, 2014, 5:36:24 AM12/12/14
to swagger-sw...@googlegroups.com
Hi Tony,

I had to understand better the integration with JAXB, so I integrated the petstore project as well. I tested a few cases and it seems OK to me.

You can use this as a baseline:

https://github.com/zouzias/swagger-jaxrs-wink

PS. Not sure if I configured correctly Jackson's JAXB annotations.

Best,
Anastasios
Reply all
Reply to author
Forward
0 new messages