Lots of classloader warnings when running Dropwizard fat jar

2,685 views
Skip to first unread message

bruce.a....@gmail.com

unread,
Nov 6, 2017, 1:25:13 PM11/6/17
to dropwizard-user

When building my app using `maven clean install` and then trying to run the subsequent JAR through the command line I get many warning messages, however when I run Dropwizard through Intellj I do not get these warnings.

Dropwizard Version: 1.2.0

I was following the instructions from the Dropwizard getting started page.

WARN  [2017-11-06 18:12:45,325] org.reflections.Reflections: could not get type for name org.apache.tools.ant.taskdefs.MatchingTask from any class loader
! java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.MatchingTask
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name org.apache.tools.ant.taskdefs.MatchingTask
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:75)
! at io.dropwizard.Application.run(Application.java:93)
! at com.shepper.ShepherdServiceApplication.main(ShepherdServiceApplication.java:24)
WARN  [2017-11-06 18:12:45,326] org.reflections.Reflections: could not get type for name org.zeroturnaround.javarebel.ClassEventListener from any class loader
! java.lang.ClassNotFoundException: org.zeroturnaround.javarebel.ClassEventListener
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name org.zeroturnaround.javarebel.ClassEventListener
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:75)
! at io.dropwizard.Application.run(Application.java:93)
! at com.shepper.ShepherdServiceApplication.main(ShepherdServiceApplication.java:24)
WARN  [2017-11-06 18:12:45,328] org.reflections.Reflections: could not get type for name groovy.lang.Closure from any class loader
! java.lang.ClassNotFoundException: groovy.lang.Closure
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name groovy.lang.Closure
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:75)
! at io.dropwizard.Application.run(Application.java:93)
! at com.shepper.ShepherdServiceApplication.main(ShepherdServiceApplication.java:24)




A.V. Ravi Kumar

unread,
Dec 18, 2017, 10:14:07 AM12/18/17
to dropwizard-user
Hi,

I faced similar issue and it seems to be a bug in org.reflections dependency(0.9.11). Downgrading  to 0.9.10 worked.

                  <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>

Viacheslav Mukha

unread,
Jan 12, 2018, 3:56:56 AM1/12/18
to dropwizard-user
Hi guys. Faced the same issue. 

But when downgraded dependency form 0.9.11 to 0.9.10 - my application simply stopped working, having the next message in the console:

INFO  [2018-01-11 16:22:18,145] org.eclipse.jetty.util.log: Logging initialized @1465ms to org.eclipse.jetty.util.log.Slf4jLog
INFO  [2018-01-11 16:22:18,263] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO  [2018-01-11 16:22:18,264] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
WARN  [2018-01-11 16:22:18,287] com.google.common.cache.CacheBuilder: ignoring weigher specified without maximumWeight


Original error is the next:
INFO  [2018-01-11 16:27:02,677] org.eclipse.jetty.util.log: Logging initialized @1615ms to org.eclipse.jetty.util.log.Slf4jLog
INFO  [2018-01-11 16:27:02,791] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO  [2018-01-11 16:27:02,792] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
WARN  [2018-01-11 16:27:02,814] com.google.common.cache.CacheBuilder: ignoring weigher specified without maximumWeight
INFO  [2018-01-11 16:29:18,529] org.eclipse.jetty.util.log: Logging initialized @1758ms to org.eclipse.jetty.util.log.Slf4jLog
INFO  [2018-01-11 16:29:18,675] io.dropwizard.server.DefaultServerFactory: Registering jersey handler with root path prefix: /
INFO  [2018-01-11 16:29:18,677] io.dropwizard.server.DefaultServerFactory: Registering admin handler with root path prefix: /
WARN  [2018-01-11 16:29:18,705] com.google.common.cache.CacheBuilder: ignoring weigher specified without maximumWeight
INFO  [2018-01-11 16:29:18,726] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: swagger-assets for path /api/swagger-static/*
INFO  [2018-01-11 16:29:18,728] io.dropwizard.assets.AssetsBundle: Registering AssetBundle with name: swagger-oauth2-connect for path /apio2c.html/*
INFO  [2018-01-11 16:29:21,158] org.reflections.Reflections: Reflections took 2415 ms to scan 1 urls, producing 35680 keys and 62732 values 
WARN  [2018-01-11 16:29:21,176] org.reflections.Reflections: could not get type for name javax.cache.management.CacheStatisticsMXBean from any class loader
! java.lang.ClassNotFoundException: javax.cache.management.CacheStatisticsMXBean
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name javax.cache.management.CacheStatisticsMXBean
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:74)
! at io.dropwizard.Application.run(Application.java:89)
! at com.test.server.ServerApplication.main(ServerApplication.java:84)
WARN  [2018-01-11 16:29:21,177] org.reflections.Reflections: could not get type for name org.springframework.beans.factory.FactoryBean from any class loader
! java.lang.ClassNotFoundException: org.springframework.beans.factory.FactoryBean
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name org.springframework.beans.factory.FactoryBean
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:74)
! at io.dropwizard.Application.run(Application.java:89)
! at com.test.server.ServerApplication.main(ServerApplication.java:84)
WARN  [2018-01-11 16:29:21,178] org.reflections.Reflections: could not get type for name org.apache.tools.ant.taskdefs.MatchingTask from any class loader
! java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.MatchingTask
! at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
! at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
! at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
! ... 14 common frames omitted
! Causing: org.reflections.ReflectionsException: could not get type for name org.apache.tools.ant.taskdefs.MatchingTask
! at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
! at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
! at org.reflections.Reflections.<init>(Reflections.java:126)
! at io.swagger.jaxrs.config.BeanConfig.classes(BeanConfig.java:276)
! at io.swagger.jaxrs.config.BeanConfig.scanAndRead(BeanConfig.java:240)
! at io.swagger.jaxrs.config.BeanConfig.setScan(BeanConfig.java:221)
! at io.federecio.dropwizard.swagger.SwaggerBundleConfiguration.build(SwaggerBundleConfiguration.java:287)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:66)
! at io.federecio.dropwizard.swagger.SwaggerBundle.run(SwaggerBundle.java:33)
! at io.dropwizard.setup.Bootstrap.run(Bootstrap.java:200)
! at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:42)
! at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:85)
! at io.dropwizard.cli.Cli.run(Cli.java:74)
! at io.dropwizard.Application.run(Application.java:89)
! at com.test.server.ServerApplication.main(ServerApplication.java:84)
WARN  [2018-01-11 16:29:21,179] org.reflections.Reflections: could not get type for name lombok.patcher.PatchScript from any class loader

bruce.a....@gmail.com, Did the fix with dependency downgrading helped for you?

понедельник, 18 декабря 2017 г., 17:14:07 UTC+2 пользователь A.V. Ravi Kumar написал:

Viacheslav Mukha

unread,
Feb 22, 2018, 11:13:51 AM2/22/18
to dropwizard-user
Here is a pom.xml that worked for me. Had to exclude some dependencies.

<dependency>
    <groupId>org.reflections</groupId>
    <artifactId>reflections</artifactId>
    <version>0.9.10</version
>
    <exclusions>
        <exclusion>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<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>

jason....@futurion.digital

unread,
May 30, 2018, 9:43:23 PM5/30/18
to dropwizard-user
Hi,

It's been a few months-- do we still have to add all these exclusions or has this been fixed? I also face this problem with version 1.3.2

Thanks, Jason

Vijay

unread,
Jan 23, 2020, 7:10:00 PM1/23/20
to dropwizard-user
Thanks for the post. It worked for me. I needed to exclude java assist also fro the reflection dependency to make it work for me.
Reply all
Reply to author
Forward
0 new messages