Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting bitten with a Graalvm-native image #190

Closed
EstebanMarin opened this issue Mar 26, 2021 · 4 comments
Closed

I am getting bitten with a Graalvm-native image #190

EstebanMarin opened this issue Mar 26, 2021 · 4 comments

Comments

@EstebanMarin
Copy link

EstebanMarin commented Mar 26, 2021

Question:

I am doing this right?

Working with a Graalvm native image and after adding the dependency

      "dev.zio"                     %% "zio-s3"                   % ZioS3Version,

I started to noticed reflection issues in build time, therefore I had to flag my graalVMNativeImageOptionsin build.sbt

graalVMNativeImageOptions ++= Seq(
  "-H:ClassInitialization=io.netty.util.internal.logging.Log4JLogger:run_time,org.apache.log4j.Logger:build_time,org.slf4j.simple.SimpleLogger:build_time,org.slf4j.impl.StaticLoggerBinder:build_time,org.slf4j.LoggerFactory:build_time,io.netty.handler.ssl.ReferenceCountedOpenSslClientContext:run_time,io.netty.handler.ssl.ReferenceCountedOpenSslServerContext:run_time,io.netty.handler.ssl.ReferenceCountedOpenSslContext:run_time,io.netty.handler.ssl.JdkNpnApplicationProtocolNegotiator:run_time,io.netty.handler.ssl.ConscryptAlpnSslEngine:run_time,io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine:run_time,io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine:run_time,io.netty.handler.ssl.JettyNpnSslEngine:run_time,io.netty.handler.ssl.ReferenceCountedOpenSslEngine:run_time,io.netty.util.AbstractReferenceCounted:run_time",

Still unsuccessful 😣

2021-03-26 10:29:29  #8 159.9 [error] Error: Classes that should be initialized at run time got initialized during image building:
2021-03-26 10:29:29  #8 159.9 [error]  org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory
2021-03-26 10:29:29  #8 159.9 [error] com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
2021-03-26 10:29:29  #8 159.9 [error]  org.slf4j.LoggerFactory was unintentionally initialized at build time. To see why org.slf4j.LoggerFactory got initialized use --trace-class-initialization=org.slf4j.LoggerFactory

My question is: Am I doing this right? I starting to be too painful to be the normal process. It feels like I need to configure a less obvious side-effect, to me at least, to make it work.

Aditional resources

Would appreciate any hint, cheers!

@regis-leray
Copy link
Member

zio-s3 dont use any logger by default, and dont bring any default implementation.
The only dependency is slf4j-api and commons-logging

What is the default loger implementation did you use JUL / logback / log4j2?

I would suggest to search onGoogle how to integrate graal vm with any java logger implementation.

here some hint
oracle/graal#2008

Google or StackOverflow is your friend in this case :)

@EstebanMarin
Copy link
Author

Thanks for taking the time to answer, and for the hint, graalvm, is still a work in progress, so, being able to point correctly is difficult still. I agree, has nothing to do with zio-s3

@atrianac
Copy link

atrianac commented Apr 5, 2021

To enable zio-s3 in GraalVM you have to enable the following configuration:

"--initialize-at-build-time=org.slf4j.LoggerFactory",
"--initialize-at-build-time=org.slf4j.simple.SimpleLogger",
"--initialize-at-build-time=org.slf4j.impl.StaticLoggerBinder",
"--initialize-at-run-time=io.netty.util.internal.logging.Log4JLogger",
"--initialize-at-run-time=io.netty.util.AbstractReferenceCounted",
"--initialize-at-run-time=io.netty.channel.epoll",
"--initialize-at-run-time=io.netty.handler.ssl",
"--initialize-at-run-time=io.netty.channel.unix"

The majority of the issues are related with netty.

@EstebanMarin
Copy link
Author

EstebanMarin commented Apr 6, 2021

thanks, @atrianac, that was it, hopefully, this is helpful to someone, closing the issue.
Link to issue graal

Montura added a commit to Montura/graal-rsocket-ios that referenced this issue May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants