Getting java.lang.NoClassDefFoundError for Netty when building image with Jib.

1,728 views
Skip to first unread message

javadevmtl

unread,
Feb 23, 2021, 2:26:45 PM2/23/21
to vert.x
Hi I'm using Jib to build Vertx 3.9.2 application and getting...

java.lang.NoClassDefFoundError: Could not initialize class io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder

I managed to make it work with.

configurations.all {
exclude module: 'netty-all'
}

Just checking if this is the way?

Julien Viet

unread,
Feb 24, 2021, 3:39:45 AM2/24/21
to vert.x
Hi,

try adding jdk.naming.dns to your image.

Julien

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/47e2578d-7306-47a6-b481-ede087fd6c72n%40googlegroups.com.

javadevmtl

unread,
Feb 24, 2021, 9:48:32 AM2/24/21
to vert.x
Hi Julien is that a new Java 9+ module? And yes It's my first Vert.x project i'm porting to Java 11.

How do i add jdk.naming.dns? to my package?

javadevmtl

unread,
Feb 24, 2021, 10:00:12 AM2/24/21
to vert.x
Hi I tried java --list-modules in the running docker image and it returns jdk.nam...@11.0.10 So it's there. 

So it only works if I remove this dependency in gradle

configurations.all {
exclude module: 'netty-all'

javadevmtl

unread,
Feb 26, 2021, 9:34:43 AM2/26/21
to vert.x
Hi Julien any thoughts on this?

Julien Viet

unread,
Feb 26, 2021, 11:00:46 AM2/26/21
to vert.x
I don't have any idea on top of my mind.

Why are you using netty-all btw ?

javadevmtl

unread,
Feb 26, 2021, 11:52:02 AM2/26/21
to vert.x
Ok looked at my dependencies.

Apache Ignite dependency in my "common" lib brings it in. So I guess I have to do an exclude...

I guess when we do shadow jars only the required classes are copied. But Jib's opinion is NO for shadow jars ands prefers to include the entire libs.

I'm moving one of my vertx apps to Java 11 and using Jib instead of the bmuschko docker gradle plugin for faster builds. So in all my years of using Vertx I never saw this. Oh well you learn new things every day lol
Reply all
Reply to author
Forward
0 new messages