Logging.appenders error

530 views
Skip to first unread message

James Harvey

unread,
Jul 16, 2014, 5:19:44 PM7/16/14
to dropwiz...@googlegroups.com
Hi all,

Facing a (really!) annoying problem that I'm sure is easily solvable.

We are building a "fat jar" in Gradle; no plugins are being used.

When specifying an appender type in our YAML config, we get an error along the lines of:

* Failed to parse configuration at: logging.appenders; Could not resolve type id 'console' into a subtype of [simple type, class io.dropwizard.logging.AppenderFactory]

This looks like the META-INF/services file for io.dropwizard.logging.AppenderFactory is missing, but an explosion of the jar shows it there.

Am I missing something obvious? We are using 0.7.1.

Any help is greatly appreciated.

Thx

James Harvey

unread,
Jul 16, 2014, 5:50:18 PM7/16/14
to dropwiz...@googlegroups.com
After doing some more digging, it looks like there are multiple versions of io.dropwizard.jackson.Discoverable being pulled into the META-INF/services dir, one for each of the Dropwizard projects that seem to re-use this pattern.

I'm guessing that Java is using class path preference and finding one of these random *.Discoverable files that doesn't including the Appender reference.

Although Gradle isn't my personal preference, I have to use it. Merging the *.Discoverable files seems like the best solution, albeit ugly to do it manually.

Any suggestions?

Jochen Schalanda

unread,
Jul 16, 2014, 5:57:13 PM7/16/14
to dropwiz...@googlegroups.com
Hi James,

On 16.07.2014 23:50, James Harvey wrote:
> Although Gradle isn't my personal preference, I have to use it.

Gradle is quite nice actually. YMMV. ;-)

I guess it's time to update the old Dropwizard/Gradle example
(https://github.com/gini/dropwizard-gradle) for the latest versions.


> Merging the *.Discoverable files seems like the best solution, albeit ugly to do it manually.
>
> Any suggestions?

You can use the Gradle Shadow
(https://github.com/johnrengelman/shadow#merging-service-files) plugin
to merge the service files. It should work almost out of the box.


Cheers,
Jochen

James Harvey

unread,
Jul 16, 2014, 7:42:39 PM7/16/14
to dropwiz...@googlegroups.com
Hehe, I'm sure Gradle is great really ;-)

Thanks for the tips, Jochen.

Unfortunately, the JCenter repo is blocked (corp environment binary control), and Shadow doesn't appear is Maven Central. It looks very promising, otherwise!

I'll take a look at OneJar, although my preference would be avoid custom classloaders if at all possible (Guice, and some other funky stuff can get confused...).

Jochen Schalanda

unread,
Jul 17, 2014, 4:30:13 AM7/17/14
to dropwiz...@googlegroups.com
On 17.07.2014 01:42, James Harvey wrote:
> Unfortunately, the JCenter repo is blocked (corp environment binary control), and Shadow doesn't appear is Maven Central. It looks very promising, otherwise!

Although that's not the optimal solution you might just put the Gradle
Shadow plugin JAR (and its dependencies) into your repository and
directly load it without the need to access an external repository [1].


> I'll take a look at OneJar, although my preference would be avoid custom classloaders if at all possible (Guice, and some other funky stuff can get confused...).

I used to have some problems with Spring IOC when using OneJar. So this
might not work.

In the end you could always manually merge the service files (as
mentioned in your first post) or use the Gradle Application plugin [2]
to build a distribution of your application without a single fat JAR.


[1]:
http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:file_dependencies
[2]: http://www.gradle.org/docs/current/userguide/application_plugin.html


Cheers,
Jochen
Reply all
Reply to author
Forward
0 new messages