You’re using an ancient version of swagger-core. Please update to the latest 
and try again.

 

 

 

From: <[email protected]> on behalf of 
"[email protected]" <[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Monday, 22 August 2016 at 10:35
To: Swagger <[email protected]>
Subject: Swagger definition generation issue

 

Hi All, 

 

I have created a sample service suing servlet, and annotated as per the swagger 
specification. But when i do http://localhost:8080/MyApp/api it gives me below 
response.

 

{"apiVersion":"0.0","swaggerVersion":"1.2"}

 

I have seen all previous discussion on this issue in this forum and other 
similar. But no luck with me. Requesting for help on this.

 

My 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>Servlet</display-name>
 
 <servlet>
 <servlet-name>DefaultServletReaderConfig</servlet-name>
 
<servlet-class>com.wordnik.swagger.servlet.config.DefaultServletReaderConfig</servlet-class>
 <init-param>
 <param-name>swagger.resource.package</param-name>
 <param-value>servlet</param-value>
 </init-param>
 <init-param>
 <param-name>swagger.api.basepath</param-name>
 <param-value>http://localhost:8080/MyApp/api/</param-value>
 </init-param>
 <init-param>
 <param-name>api.version</param-name>
 <param-value>1.0.0</param-value>
 </init-param>


 </servlet>
 <servlet>
 <servlet-name>ApiDeclarationServlet</servlet-name>
 
<servlet-class>com.wordnik.swagger.servlet.listing.ApiDeclarationServlet</servlet-class>
 </servlet>
 <servlet-mapping>
 <servlet-name>ApiDeclarationServlet</servlet-name>
 <url-pattern>/api/*</url-pattern>
 </servlet-mapping>
 
</web-app>

 

My POM.xml is as below

 

<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>Servlet</groupId>
  <artifactId>Servlet</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.3.11</version>
        </dependency>
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-servlet_2.10</artifactId>
            <version>1.3.13</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-servlet</artifactId>
            <version>1.5.7</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-jersey-jaxrs_2.10</artifactId>
            <version>1.3.13</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>
        <dependency>
            <groupId>com.wordnik</groupId>
            <artifactId>swagger-core_2.10</artifactId>
            <version>1.3.13</version>
            <scope>compile</scope>
        </dependency>
 </dependencies>
</project>

 

Thanks

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to