如何将swagger与tomcat集成?

时间:2015-08-21 05:59:16

标签: java rest swagger

我是摇摇欲坠的新手,我正试图摇摆到我的tomcat应用程序,下面是我的WEb.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Restful Web Application</display-name>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:xxx/xxx/xxx/xml/applicationContext.xml</param-value>
  </context-param>

  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <servlet>
    <servlet-name>jersey-helloworld-serlvet</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>xxx.xxx.xxx.resource</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet>
        <servlet-name>JerseyJaxrsConfig</servlet-name>
        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
        <init-param>
            <param-name>api.version</param-name>
            <param-value>1.0.0</param-value>
        </init-param>
        <init-param>
            <param-name>swagger.api.basepath</param-name>
            <param-value>http://localhost:8088/sms</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>
  <servlet-mapping>
    <servlet-name>jersey-helloworld-serlvet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>


</web-app>

我将Swagger Ui添加到我的WebContent / WEB-INF文件夹中,并添加了 招摇,annotations_2.9.1 招摇汗布,jaxrs_2.10 swagger-core_2.10罐子到我的班级路径 我收到以下错误: java.lang.NoClassDefFoundError:com / wordnik / swagger / config / ConfigFactory

感谢你的帮助。

0 个答案:

没有答案