Hi,
    Did you find any way for ServiceResourceTransformer to work for 
multiple services for same interface ? I am facing same issue in year 2019 
with latest versions of maven shade plugin and of Dropwizard. I am able to 
do same workaround as of yours. But not able to find what shade plugin can 
offer for this problem.

On Thursday, July 21, 2016 at 2:53:07 AM UTC+5:30, Rudi Wirth wrote:
>
>
>
> On Tuesday, July 19, 2016 at 4:58:21 PM UTC-4, Rudi Wirth wrote:
>>
>> I even added some code stolen from DiscoverableSubtypeResolver which 
>> prints out various DW factories:
>>
>> ..
>>
>> The list looks correct, both running from java -jar uber-jar and running 
>> out of Eclipse
>>
>
> I should've looked harder. I only looked at the leave classes. I ended up 
> debugging the discovery stuff, here:
>
> Thread [main] (Suspended)    
>     DiscoverableSubtypeResolver.<init>(Class<?>) line: 40    
>     DiscoverableSubtypeResolver.<init>() line: 29    
>     Jackson.configure(ObjectMapper) line: 61    
>     Jackson.newObjectMapper() line: 23    
>     Bootstrap<T>.<init>(Application<T>) line: 64    
>
>
> Uber-jar:
>
> resource 
> jar:file:/opt/nuodb/jar/nuoagent2.jar!/META-INF/services/io.dropwizard.jackson.
> *Discoverable*
>  io.dropwizard.server.ServerFactory
> resource 
> jar:file:/opt/nuodb/jar/nuoagent2.jar!/META-INF/services/io.dropwizard.jetty.ConnectorFactory
>  io.dropwizard.jetty.HttpConnectorFactory
>  io.dropwizard.jetty.HttpsConnectorFactory
> resource 
> jar:file:/opt/nuodb/jar/nuoagent2.jar!/META-INF/services/io.dropwizard.logging.AppenderFactory
>  io.dropwizard.logging.ConsoleAppenderFactory
>  io.dropwizard.logging.FileAppenderFactory
>  io.dropwizard.logging.SyslogAppenderFactory
> resource 
> jar:file:/opt/nuodb/jar/nuoagent2.jar!/META-INF/services/io.dropwizard.metrics.ReporterFactory
>  io.dropwizard.metrics.ConsoleReporterFactory
>  io.dropwizard.metrics.CsvReporterFactory
>  io.dropwizard.metrics.Slf4jReporterFactory
> resource 
> jar:file:/opt/nuodb/jar/nuoagent2.jar!/META-INF/services/io.dropwizard.server.ServerFactory
>  io.dropwizard.server.DefaultServerFactory
>  io.dropwizard.server.SimpleServerFactory
>
> Eclipse or mvn exec:java:
>
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-core/0.9.1/dropwizard-core-0.9.1.jar!/META-INF/services/io.dropwizard.jackson.
> *Discoverable*
>  io.dropwizard.server.ServerFactory
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-jetty/0.9.1/dropwizard-jetty-0.9.1.jar!/META-INF/services/io.dropwizard.jackson.
> *Discoverable*
>  io.dropwizard.jetty.ConnectorFactory
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-logging/0.9.1/dropwizard-logging-0.9.1.jar!/META-INF/services/io.dropwizard.jackson.
> *Discoverable*
>  io.dropwizard.logging.AppenderFactory
>  io.dropwizard.logging.LoggingFactory
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-metrics/0.9.1/dropwizard-metrics-0.9.1.jar!/META-INF/services/io.dropwizard.jackson.
> *Discoverable*
>  io.dropwizard.metrics.ReporterFactory
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-jetty/0.9.1/dropwizard-jetty-0.9.1.jar!/META-INF/services/io.dropwizard.jetty.ConnectorFactory
>  io.dropwizard.jetty.HttpConnectorFactory
>  io.dropwizard.jetty.HttpsConnectorFactory
> resource 
> jar:file:/Users/rwirth/.m2/repository/io/dropwizard/dropwizard-logging/0.9.1/dropwizard-logging-0.9.1.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/.m2/repository/io/dropwizard/dropwizard-metrics/0.9.1/dropwizard-metrics-0.9.1.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/.m2/repository/io/dropwizard/dropwizard-core/0.9.1/dropwizard-core-0.9.1.jar!/META-INF/services/io.dropwizard.server.ServerFactory
>  io.dropwizard.server.DefaultServerFactory
>  io.dropwizard.server.SimpleServerFactory
>
> So for some reason, the shade plugin did not take care of multiple 
> services for the same interface in 4 jars, 
> META-INF/services/io.dropwizard.jackson.Discoverable
>
> I was able to jar xf the 
> META-INF/services/io.dropwizard.jackson.Discoverable, 
> edit it, then jar uf the uber-jar and DW is starting up. Same with 
>
> META-INF/services/javax.validation.spi.ValidationProvider per my initial post.
>
>
> Once I know how to make the ServicesResourceTransformer 
> <https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#ServicesResourceTransformer>
>  
> behave, I'll post again. I have no idea why one of our rest apps works 
> fine, and this one doesn't, when they both use the same maven shade step.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to