We have a new project that uses Facebook Swift / Thrift, Guice, Airlift along with DW 0.9.3.
Running DW out of Eclipse or running tests with DW under junit all works fine.
Issues start with maven shade. First error was
ERROR [2016-07-18 12:24:16,937] RestRunnerImpl: failed to start
! javax.validation.ValidationException: Unable to find provider: class org.hibernate.validator.HibernateValidator
! at javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:224) ~[nuoagent2.jar:na]
! at io.dropwizard.validation.BaseValidator.newConfiguration(BaseValidator.java:28) ~[nuoagent2.jar:na]
! at io.dropwizard.jersey.validation.Validators.newConfiguration(Validators.java:35) ~[nuoagent2.jar:na]
! at io.dropwizard.jersey.validation.Validators.newValidatorFactory(Validators.java:27) ~[nuoagent2.jar:na]
! at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:68) ~[nuoagent2.jar:na]
! at io.dropwizard.Application.run(Application.java:72) ~[nuoagent2.jar:na]
! at com.nuodb.nagent.rest.RestRunnerImpl.start(RestRunnerImpl.java:43) ~[nuoagent2.jar:na]
! at com.nuodb.nagent.AgentMain.run(AgentMain.java:263) [nuoagent2.jar:na]
! at com.nuodb.nagent.AgentMain.main(AgentMain.java:153) [nuoagent2.jar:na]
which I was able to fix by editing and re-jar-ing META-INF/services/javax.validation.spi.ValidationProvider, with both providers (Apache came in via airlift):
org.apache.bval.jsr303.ApacheValidationProvider
org.hibernate.validator.HibernateValidator
Now I get a parsing error on the yml file. We test .yml files with both DefaultServerFactory and SimpleServerFactory.
Either stumbles over
/opt/nuodb/etc/nagentrest.yml has an error:
* Failed to parse configuration at: server.applicationConnectors.[0]; Could not resolve type id 'http' into a subtype of [simple type, class io.dropwizard.jetty.ConnectorFactory]: known type ids = [ConnectorFactory]
at [Source: N/A; line: -1, column: -1] (through reference chain: com.nuodb.nagent.rest.NewAgentRestConfig["server"]->io.dropwizard.server.DefaultServerFactory["applicationConnectors"]->java.util.ArrayList[0])
This is well-documented in other threads, and I've made sure that the uber-jar contains all the services.
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
I even added some code stolen from DiscoverableSubtypeResolver which prints out various DW factories:
resource jar:file:/Users/rwirth/dev/nuodb_raft/nagent/target/nuoagent2-2.0-jar-with-dependencies.jar!/META-INF/services/io.dropwizard.jackson.Discoverable
io.dropwizard.server.ServerFactory
resource jar:file:/Users/rwirth/dev/nuodb_raft/nagent/target/nuoagent2-2.0-jar-with-dependencies.jar!/META-INF/services/io.dropwizard.jetty.ConnectorFactory
io.dropwizard.jetty.HttpConnectorFactory
io.dropwizard.jetty.HttpsConnectorFactory
resource jar:file:/Users/rwirth/dev/nuodb_raft/nagent/target/nuoagent2-2.0-jar-with-dependencies.jar!/META-INF/services/io.dropwizard.logging.AppenderFactory
io.dropwizard.logging.ConsoleAppenderFactory
io.dropwizard.logging.FileAppenderFactory
io.dropwizard.logging.SyslogAppenderFactory
resource jar:file:/Users/rwirth/dev/nuodb_raft/nagent/target/nuoagent2-2.0-jar-with-dependencies.jar!/META-INF/services/io.dropwizard.metrics.ReporterFactory
io.dropwizard.metrics.ConsoleReporterFactory
io.dropwizard.metrics.CsvReporterFactory
io.dropwizard.metrics.Slf4jReporterFactory
resource jar:file:/Users/rwirth/dev/nuodb_raft/nagent/target/nuoagent2-2.0-jar-with-dependencies.jar!/META-INF/services/io.dropwizard.server.ServerFactory
io.dropwizard.server.DefaultServerFactory
io.dropwizard.server.SimpleServerFactory
The list looks correct, both running from java -jar uber-jar and running out of Eclipse.
I'm running out of ideas where else to look. Perhaps a different class loader / service loader issue?
Any hints are much appreciated!