Issue using JdbiFactory()

54 views
Skip to first unread message

Dondell Batac

unread,
Aug 4, 2021, 5:21:31 AM8/4/21
to dropwizard-user
JdbiFactory factory = new JdbiFactory();
jdbiMysql = factory.build(environment, config.database, "mysql");
jdbiPostgres = factory.build(environment, config.database2, "postgresql");

ERROR:
Caused by: java.lang.ClassNotFoundException: com.codahale.metrics.jdbi3.strategies.StatementNameStrategy

FULL ERROR:
java.lang.NoClassDefFoundError: com/codahale/metrics/jdbi3/strategies/StatementNameStrategy
    at com.fulcrumgt.tardis.TardisApplication.run(TardisApplication.java:169)
    at com.fulcrumgt.tardis.TardisApplication.run(TardisApplication.java:72)
    at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:44)
    at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:87)
    at io.dropwizard.cli.Cli.run(Cli.java:79)
    at io.dropwizard.Application.run(Application.java:94)
    at com.fulcrumgt.tardis.TardisApplication.main(TardisApplication.java:87)
Caused by: java.lang.ClassNotFoundException: com.codahale.metrics.jdbi3.strategies.StatementNameStrategy
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 7 more

Jochen Schalanda

unread,
Aug 4, 2021, 5:37:45 PM8/4/21
to dropwizard-user
Hi,

Which version of Dropwizard are you using exactly?
Could you share the build file for your project or at least a complete list of dependencies?

Cheers,
Jochen

--
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 dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/11337230-d518-4990-a1c2-66f6a80ec878n%40googlegroups.com.

Dondell Batac

unread,
Aug 5, 2021, 7:32:09 PM8/5/21
to dropwizard-user
I am using jdbi-core-3.21.0. But I have fixed the issue by including the classes below on my project manually.
Screenshot from August 6, 2021 7_31 AM.png

Jochen Schalanda

unread,
Aug 6, 2021, 2:08:52 AM8/6/21
to dropwizard-user
Hi,

I am using jdbi-core-3.21.0. But I have fixed the issue by including the classes below on my project manually.

These files are part of io.dropwizard.metrics:metrics-jdbi3 (https://search.maven.org/artifact/io.dropwizard.metrics/metrics-jdbi3).

Adding this as a dependency should do the trick.

This is also pulled in by io.dropwizard:dropwizard-jdbi3 (see https://github.com/dropwizard/dropwizard/blob/v2.0.24/dropwizard-jdbi3/pom.xml#L84-L87), so something seems to be broken with your dependency management.

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