Hi,

I am sorry to ask this question as I think similar ones have been asked 
before. I've gone through them but I still can't seem to solve my problem. 

*Problem*
I've been using the guide at 
https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5#configure-and-initialize-swagger
 
to add Swagger to my Jersey project using the *Package* scanning method. 
However, I can't access the definition at /swagger.json.

I don't have any problems accessing resources which are located at:

> http://localhost:8080/ergo/api/*{resource_name}*


The Jersey version is 2.16. Here is the pom.xml file with the Swagger 
dependency added:

<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/maven-v4_0_0.xsd";>

    <modelVersion>4.0.0</modelVersion>

    <groupId>net.lodgeit</groupId>

    <artifactId>ergo</artifactId>

    <packaging>war</packaging>

    <version>1.0.0</version>

    <name>ergo</name>

    <build>

        <finalName>ergo</finalName>

        <plugins>

            <plugin>

                <groupId>org.apache.maven.plugins</groupId>

                <artifactId>maven-compiler-plugin</artifactId>

                <version>2.5.1</version>

                <inherited>true</inherited>

                <configuration>

                    <source>1.7</source>

                    <target>1.7</target>

                </configuration>

            </plugin>

        </plugins>

    </build>

    <dependencyManagement>

        <dependencies>

            <dependency>

                <groupId>org.glassfish.jersey</groupId>

                <artifactId>jersey-bom</artifactId>

                <version>${jersey.version}</version>

                <type>pom</type>

                <scope>import</scope>

            </dependency>

        </dependencies>

    </dependencyManagement>


    <dependencies>

        <dependency>

            <groupId>org.glassfish.jersey.containers</groupId>

            <artifactId>jersey-container-servlet-core</artifactId>

            <!-- use the following artifactId if you don't need servlet 2.x 
compatibility -->

            <!-- artifactId>jersey-container-servlet</artifactId -->

        </dependency>

        <dependency>

     <groupId>org.glassfish.jersey.media</groupId>

     <artifactId>jersey-media-json-jackson</artifactId>

     <version>2.26-b09</version>

</dependency>

       <dependency>

      <groupId>io.swagger</groupId>

      <artifactId>swagger-jersey2-jaxrs</artifactId>

      <scope>compile</scope>

      <version>1.5.0</version>

</dependency>

    </dependencies>

    <properties>

        <jersey.version>2.16</jersey.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    </properties>

</project>

Here is the web.xml file:

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

<!-- This web.xml file is not required when using Servlet 3.0 container,

     see implementation details 
http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"; 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";>

    <servlet>

        <servlet-name>Jersey Web Application</servlet-name>

        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</
servlet-class>

        <init-param>

            <param-name>jersey.config.server.provider.packages</param-name>

            <param-value>io.swagger.jaxrs.listing,net.lodgeit.ergo</
param-value>

        </init-param>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>Jersey Web Application</servlet-name>

        <url-pattern>/api/*</url-pattern>

    </servlet-mapping>

    <servlet>

        <servlet-name>Jersey2Config</servlet-name>

        <servlet-class>io.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:8080/ergo</param-value>

        </init-param>

        <load-on-startup>2</load-on-startup>

    </servlet>

</web-app>

For the *<param-value>* for *swagger.api.basepath*, I have tried:
- http://localhost:8080/ergo
- http://localhost:8080/ergo/
- http://localhost:8080/ergo/api
- http://localhost:8080/ergo/api/

None of them to worked for me. I am not sure what is going on. Any help 
will be appreciated.

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.

Reply via email to