federecio / dropwizard-swagger

a Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints.
Other
130 stars 184 forks source link

Error while Running dropwizard-swagger #94

Open ashishrathore1 opened 7 years ago

ashishrathore1 commented 7 years ago

I am using dropwizard-swagger version 0.7.0 with dropwizard 0.8.2 but while running i am getting following error. I am using java 1.8 plugin . Please help me or provide another alternate to use

Exception in thread "main" java.lang.NoSuchMethodError: org.reflections.util.ClasspathHelper.forPackage(Ljava/lang/String;[Ljava/lang/ClassLoader;)Ljava/util/Collection; at com.wordnik.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:168) at com.wordnik.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:146) at io.federecio.dropwizard.swagger.SwaggerBundle.setUpSwagger(SwaggerBundle.java:109) at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:62) at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:37) at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:183) at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:41) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76) at io.dropwizard.cli.Cli.run(Cli.java:70) at io.dropwizard.Application.run(Application.java:73) at com.lk.leadservice.DropdemowithhibernateApplication.main(DropdemowithhibernateApplication.java:58)

ghost commented 6 years ago

For dropwizard-swagger-1.2.2-1 tthis seems to be a bug in the reflections-0.9.11 JAR which swagger depends on.

Use this in your pom.xml:

<dependency>
  <groupId>com.smoketurner</groupId>
    <artifactId>dropwizard-swagger</artifactId>
    <version>1.1.2-1</version>
    <exclusions>
      <exclusion>
        <groupId>org.reflections</groupId>
        <artifactId>reflections</artifactId>
      </exclusion>
    </exclusions>
  </dependency>
  <dependency>
    <groupId>org.reflections</groupId>
    <artifactId>reflections</artifactId>
    <version>0.9.10</version>
  </dependency>