micronaut-projects/micronaut-examples

Can't initialize class io.netty.handler.codec.http.HttpServerCodec when running a native image of hello-world-java example

olyagpl opened this issue · 4 comments

Hi team,

I've been testing hello-world-java example with GraalVM EE 20.0.0 based on 8 running it as a native image. A native image (fallback or non-fallback) of this demo builds, starts, but when you try to open it in the browser (http://localhost:8080/hello/John), connection fails with:
Built with Native Image of GraalVM EE 20.0.0 based on 8

19:29:02.209 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 167ms. Server Running: http://localhost:8080
19:29:24.838 [nioEventLoopGroup-2-3] WARN  io.netty.channel.ChannelInitializer - Failed to initialize a channel. Closing: [id: 0x5ea0c746, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:59077]
java.lang.ExceptionInInitializerError: null
...

failure-message.txt

Is there anything that can be done from Micronaut side?
Thanks

We will take a look. Thanks!

Hi Olga,

I've pushed a commit to a branch adding support for GraalVM: 3074b1b

I've tried with GraalVM 20.0.0 EE and it works as expected. Can you please check it again? If still doesn't work, can you please push your code to some repo so I can take a look?

Thanks!

Hi Ivan,
I've retested with your updates and running as a native-image works now.
Thanks for having a look,
Olya

Glad it works for you :-)