Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-1999

Not able to enable swagger documentation when using spring-boot-kieserver

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.5.0.GA
    • 7.2.1.GA
    • Kie-Server
    • CR1
    • ?
    • Hide

      1. added kieserver.swagger.enabled=true in application.properties file
      2. added below dependencies in pom.xml of business-application-service project:

      <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>swagger-ui</artifactId>
              <version>2.2.10</version>
          </dependency>
          <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
            <version>3.1.11</version>
          </dependency>
          <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-jaxrs</artifactId>
            <version>1.5.20</version>
            <exclusions>
              <exclusion>
                <groupId>javax.ws.rs</groupId>
                <artifactId>jsr311-api</artifactId>
              </exclusion>
            </exclusions>
      </dependency>
      

      When I try to access http://localhost:8090/rest/api-docs/?url=../swagger.json it fails with below exception:

      WARN 2252 --- [0.1-8090-exec-5] o.a.c.j.i.WebApplicationExceptionMapper  : javax.ws.rs.NotFoundException: HTTP 404 Not Found
          at org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService.getResource(Swagger2Feature.java:437)
          at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
      . . .
      Caused by: java.io.FileNotFoundException: JAR entry META-INF/resources/webjars/swagger-ui/2.2.10/api-docs/lib/swagger-oauth.js not found in /NotBackedUp/BRMS/BPMS-7/RHPAM7.2/spring-boot/business-application/business-application-service/target/business-application-service-1.0-SNAPSHOT.jar!/BOOT-INF/lib/swagger-ui-2.2.10.jar
          at org.springframework.boot.loader.jar.JarURLConnection.throwFileNotFound(JarURLConnection.java:186)
          at org.springframework.boot.loader.jar.JarURLConnection.connect(JarURLConnection.java:105)
          at org.springframework.boot.loader.jar.JarURLConnection.getInputStream(JarURLConnection.java:170)
          at java.net.URL.openStream(URL.java:1038)
          at org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService.getResource(Swagger2Feature.java:431)
          ... 93 more
      
      

      In the web console I can see, css files from swagger-ui-2.2.10.jar are loaded without any issue, but it failed to load js files. Take a look at attached screenshot. Debug enabled logs also attached.

      Show
      1. added kieserver.swagger.enabled=true in application.properties file 2. added below dependencies in pom.xml of business-application-service project: <dependency> <groupId>org.webjars</groupId> <artifactId>swagger-ui</artifactId> <version>2.2.10</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-swagger</artifactId> <version>3.1.11</version> </dependency> <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jaxrs</artifactId> <version>1.5.20</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId> </exclusion> </exclusions> </dependency> When I try to access http://localhost:8090/rest/api-docs/?url=../swagger.json it fails with below exception: WARN 2252 --- [0.1-8090-exec-5] o.a.c.j.i.WebApplicationExceptionMapper : javax.ws.rs.NotFoundException: HTTP 404 Not Found at org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService.getResource(Swagger2Feature.java:437) at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) . . . Caused by: java.io.FileNotFoundException: JAR entry META-INF/resources/webjars/swagger-ui/2.2.10/api-docs/lib/swagger-oauth.js not found in /NotBackedUp/BRMS/BPMS-7/RHPAM7.2/spring-boot/business-application/business-application-service/target/business-application-service-1.0-SNAPSHOT.jar!/BOOT-INF/lib/swagger-ui-2.2.10.jar at org.springframework.boot.loader.jar.JarURLConnection.throwFileNotFound(JarURLConnection.java:186) at org.springframework.boot.loader.jar.JarURLConnection.connect(JarURLConnection.java:105) at org.springframework.boot.loader.jar.JarURLConnection.getInputStream(JarURLConnection.java:170) at java.net.URL.openStream(URL.java:1038) at org.apache.cxf.jaxrs.swagger.Swagger2Feature$SwaggerUIService.getResource(Swagger2Feature.java:431) ... 93 more In the web console I can see, css files from swagger-ui-2.2.10.jar are loaded without any issue, but it failed to load js files. Take a look at attached screenshot. Debug enabled logs also attached.
    • 2019 Week 32-34, 2019 Week 35-37

    Description

      Not able to see Swagger documentation of the REST api as part of kie-server Spring Boot application.

      Attachments

        1. business-application-08-08-2019.zip
          248 kB
        2. Screenshot-kie-server-swagger.png
          Screenshot-kie-server-swagger.png
          280 kB
        3. Spring-boot-kieserver
          1.02 MB
        4. stacktrace.txt
          267 kB

        Issue Links

          Activity

            People

              elguardian@gmail.com Enrique González Martínez (Inactive)
              rhn-support-abhumbe Abhijit Humbe
              Karel Suta Karel Suta
              Karel Suta Karel Suta
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: