I am not sure what is going on, I have a simple project that only have a ping service and I am trying to play with the Swagger integration with. But when I try to run it, it throws NoSuchMethodError on
Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.validator.HibernateValidatorConfiguration.addValidatedValueHandler(Lorg/hibernate/validator/spi/valuehandling/ValidatedValueUnwrapper;)Lorg/hibernate/validator/HibernateValidatorConfiguration;
at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:72)
at io.dropwizard.Application.run(Application.java:68)
compile 'com.wordnik:swagger-jaxrs_2.10:1.3.12'
compile group: 'com.hubspot.dropwizard', name: 'dropwizard-guice', version:'0.8.0'
compile group: 'io.dropwizard.modules', name: 'dropwizard-java8', version: '0.8.0-1'
The Application class looks like the following
public class RestServiceApplication extends Application< RestServiceConfiguration>
{
private GuiceBundle<RestServiceConfiguration> guiceBundle;
public static void main(String[] args) throws Exception {
new RestServiceApplication().run(args);
}
@Override
public void initialize(Bootstrap<RestServiceConfiguration> bootstrap) {
bootstrap.getObjectMapper().registerModules(new JavaOptionalModule());
bootstrap.getObjectMapper().registerModules(new JSR310Module());
bootstrap.addBundle(new Java8Bundle());
guiceBundle = GuiceBundle.<RestServiceConfiguration>newBuilder()
.addModule(new ProfileReadRepairRestServiceModule())
.enableAutoConfig(getClass().getPackage().getName())
.setConfigClass(RestServiceConfiguration.class)
.build();
bootstrap.addBundle(guiceBundle);
}
@Override
public String getName() {
return "Rest Service";
}
@Override
public void run(RestServiceConfiguration configuration, Environment environment)
throws Exception
{
// Swagger Resource
environment.jersey().register(new ApiListingResourceJSON());
// Swagger providers
environment.jersey().register(new ApiDeclarationProvider());
environment.jersey().register(new ResourceListingProvider());
// Swagger Scanner, which finds all the resources for @Api Annotations
ScannerFactory.setScanner(new DefaultJaxrsScanner());
// Add the reader, which scans the resources and extracts the resource information
ClassReaders.setReader(new DefaultJaxrsApiReader());
// Set the swagger config options
SwaggerConfig config = ConfigFactory.config();
config.setApiVersion("1.0.1");
config.setBasePath("http://localhost:8000");
}
}
Thanks a lot,
Felix