0

Development environment:

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.6, vendor: Oracle Corporation, runtime: /home/linuxlp/opt/graalvm/graalvm-svm-linux-20.1.0-ea+28
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-31-generic", arch: "amd64", family: "unix"

My application uses Reactor Netty for client http rest services. The io.netty libraries are generating INFO errors since some of these classes are getting initialized at build time, but they need to be initialized at runtime. There is a Graalvm flag --initialize-at-run-time that I would like to try, but I don't see how to implement it. I tried to implement it in a config file "initruntime" and put that file in the resources/META-INF/substrate/config directory, but this didn't work. Part of client-debug0.log file is included below showing one of the exceptions:

[Sun May 24 18:38:16 EDT 2020][INFO] [SUB] Error: Class initialization of io.netty.handler.ssl.JettyNpnSslEngine failed. Use the option --initialize-at-run-time=io.netty.handler.ssl.JettyNpnSslEngine to explicitly request delayed initialization of this class.

1 Answers1

0

You can add this command to the list of native-image commands like this:

<nativeImageArgs>
    <nativeImageArg>--initialize-at-build-time=com.mycompany.main.internal.NativeImageStaticInitializer</nativeImageArg>
</nativeImageArgs>
mipa
  • 10,369
  • 2
  • 16
  • 35
  • I added --initialize-at-run-time to configuration as shown: --initialize-at-run-time=java.net.Inet6Address , but getting java.net.Inet6Address the class was requested to be initialized at build time. Does seem to see the arg. – Chris Grimes May 25 '20 at 14:34
  • Added multiple --initialize-at-run-time args, but client:compile continues to fail. This app used Reactor Netty for client/server communication. This app compiles and runs native on linux if I use the graalvm native-image-maven-plugin, but I need an IOS native image. Opened issue #619 at https://github.com/gluonhq/substrate/issues/619 to provide more details – Chris Grimes May 26 '20 at 14:12