Dropwizard-swagger with Dropwizard 1.3
NickName:user_mda Ask DateTime:2018-04-12T02:58:25

Dropwizard-swagger with Dropwizard 1.3

I am using the dropwizard-swagger dependency with Dropwizard 1.3 as follows

<dependency>
            <groupId>com.smoketurner</groupId>
            <artifactId>dropwizard-swagger</artifactId>
            <version>1.3.0-1</version>
        </dependency>

From the docs , it looks like this is the only compatible version . However I run into an issue

ClassNotFoundException: org.zeroturnaround.javarebel.ClassEventListener

From some research it looks like this is coming from a glassfish dependency, I dont seem to find anything that brings in this dependency. Wat have I missed?

Copyright Notice:Content Author:「user_mda」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/49782606/dropwizard-swagger-with-dropwizard-1-3

Answers
krister 2018-05-12T08:17:20

After digging into the source code of: dropwizard-swagger I found that in versions hihger than 1.1.0-1 they introduced BeanConfig. BeanConfig scanns all classes (not only the ones you set as resource packages) and tries to create class objects for them. \n\nThe \"problem\" is that there are plenty of classes in the resulting shaded jar that are using import statements of classes that are not provided/used by your (or alt least mine) dropwizard application.\n\nSimple solution: roll back to dropwizard-swagger version 1.1.0-1\ndrawback: you are limited to an older swagger version\n\nhard solution: figure out which dependencies are pulling in classes that are using imports to the classes that are failing during dropwisard app start \n\nNOTE!\nI'm using dropwizard-bom and I don't have any strange dependencies",


Arie 2018-12-07T19:17:50

For me excluding org.reflections solved the issue...\n\n<dependency>\n <groupId>com.smoketurner</groupId>\n <artifactId>dropwizard-swagger</artifactId>\n <version>1.3.5-3</version>\n <exclusions>\n <exclusion>\n <groupId>org.reflections</groupId>\n <artifactId>reflections</artifactId>\n </exclusion>\n </exclusions>\n </dependency>\n",


Mehul Gupta 2019-09-06T10:27:39

I have used swagger for documentation and this works for me..\n\n <groupId>com.smoketurner</groupId>\n <artifactId>dropwizard-swagger</artifactId>\n <version>1.3.12-1</version>\n <exclusions>\n <exclusion>\n <groupId>org.glassfish.hk2.external</groupId>\n <artifactId>javax.inject</artifactId>\n </exclusion>\n </exclusions>\n </dependency>```\n",


More about “Dropwizard-swagger with Dropwizard 1.3” related questions

Dropwizard-swagger with Dropwizard 1.3

I am using the dropwizard-swagger dependency with Dropwizard 1.3 as follows &lt;dependency&gt; &lt;groupId&gt;com.smoketurner&lt;/groupId&gt; &lt;artifactId&gt;dropwizard-s...

Show Detail

How to tell dropwizard-swagger/swagger-ui that there is no request body on a resource method?

I'm integrating dropwizard-swagger into a large existing project. I've got the Swagger UI endpoint up and running now, but I'm noticing that it seems adamant that every method must have a body par...

Show Detail

You need to provide an instance of SwaggerBundleConfiguration in Dropwizard

I am using swagger with dropwizard by using this module https://github.com/smoketurner/dropwizard-swagger I have followed all the relevant steps and When I a running the app I am getting this error...

Show Detail

Com Smoketurner dropwizard-swagger with dropwizard 1.1.4 throws Null Pointer Exception at specFilter class

I am trying to upgrade DropWizard version from 0.9.2 to 1.1.4, and in turn change the com.smoketurner dropwizard-swagger 1.1.1-1 which downloads dependencies: io\swagger\swagger-jersey2-jaxrs\1.5...

Show Detail

MarkLogic integration with Dropwizard

I am trying to use MarkLogic DB in Dropwizard application for data persistence. I tried with different versions combinations but still facing issues. Exception in thread "main" java.lang.

Show Detail

Dropwizard 0.8.0 static content request logging

My Dropwizard (0.8.0) logging configuration is as below and working as expected: logging: level: INFO loggers: com.netflix.config: DEBUG org.hibernate: WARN appenders: - type: co...

Show Detail

Dropwizard, swagger and in-memory hiverunner/hiveqlunit integration

I am having some trouble trying to run an in-memory hive while writing tests for a dropwizard swagger app. I have tried both hiverunner and hiveqlunit. There are 2 types of tests. One is for test...

Show Detail

How to use multiple liquibase migration changelog files in dropwizard 1.3.x?

Here is what I'm looking at: https://www.liquibase.org/documentation/includeall.html (This is to use the includeAll tag) https://www.dropwizard.io/en/release-1.3.x/manual/migrations.html (This is...

Show Detail

Dropwizard swagger returns "no-content'

Hello I am using the dropwizard-swagger bundle for my dropwzard API. I have added exception handling to return custom error codes and messages. These are rendered correctly from the API but someho...

Show Detail

Swagger integration into Dropwizard

I am fairly new to drop wizard (dropwizard.io) &amp; just completed their tutorial. I would like to integrate Swagger (swagger.io) into this sample app. I found: github.com/federecio/dropwizard-sw...

Show Detail