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

Native image build of tests/integration/jpa fails because of org.glassfish.hk2.utilities.CleanerFactory.commonCleaner initialization #9025

Closed
Tomas-Kraus opened this issue Jul 23, 2024 · 1 comment · Fixed by #9027
Assignees
Labels
3.x Issues for 3.x version branch build graal webserver

Comments

@Tomas-Kraus
Copy link
Member

Build fails with following error:

Error: Detected a java.lang.ref.Cleaner object in the image heap which uses a daemon thread that invokes cleaning actions, but threads running in the image generator are no longer running at image runtime.  To see how this object got instantiated use --trace-object-instantiation=java.lang.ref.Cleaner. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace: Object was reached by
  trying to constant fold static field org.glassfish.hk2.utilities.CleanerFactory.commonCleaner
    at org.glassfish.hk2.utilities.CleanerFactory.create(CleanerFactory.java:53)
  parsing method org.glassfish.hk2.utilities.CleanerFactory.create(CleanerFactory.java:53) reachable via the parsing context
    at static root method.(Unknown Source)

And the hk2-utils are dependency of webserver

[INFO] |  +- io.helidon.webserver:helidon-webserver-jersey:jar:3.2.9-SNAPSHOT:compile
[INFO] |  |  +- io.helidon.jersey:helidon-jersey-server:jar:3.2.9-SNAPSHOT:compile
[INFO] |  |  |  \- org.glassfish.jersey.core:jersey-server:jar:3.0.14:compile
[INFO] |  |  |     \- jakarta.validation:jakarta.validation-api:jar:3.0.0:compile
[INFO] |  |  +- io.netty:netty-buffer:jar:4.1.108.Final:compile
[INFO] |  |  +- io.helidon.jersey:helidon-jersey-client:jar:3.2.9-SNAPSHOT:compile
[INFO] |  |  |  \- org.glassfish.jersey.core:jersey-client:jar:3.0.14:compile
[INFO] |  |  \- org.glassfish.jersey.inject:jersey-hk2:jar:3.0.14:compile
[INFO] |  |     +- org.glassfish.jersey.core:jersey-common:jar:3.0.14:compile
[INFO] |  |     |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.3:compile
[INFO] |  |     +- org.glassfish.hk2:hk2-locator:jar:3.0.6:compile
[INFO] |  |     |  +- org.glassfish.hk2.external:aopalliance-repackaged:jar:3.0.6:compile
[INFO] |  |     |  +- org.glassfish.hk2:hk2-api:jar:3.0.6:compile
[INFO] |  |     |  \- org.glassfish.hk2:hk2-utils:jar:3.0.6:compile

@Tomas-Kraus Tomas-Kraus added build graal webserver 3.x Issues for 3.x version branch labels Jul 23, 2024
@Tomas-Kraus Tomas-Kraus self-assigned this Jul 23, 2024
@Tomas-Kraus
Copy link
Member Author

Fix is simple, add -initialize-at-run-time=org.glassfish.hk2.utilities.CleanerFactory into native image properties.

Tomas-Kraus added a commit to Tomas-Kraus/helidon that referenced this issue Jul 23, 2024
Tomas-Kraus added a commit to Tomas-Kraus/helidon that referenced this issue Jul 23, 2024
Tomas-Kraus added a commit to Tomas-Kraus/helidon that referenced this issue Jul 23, 2024
Tomas-Kraus added a commit that referenced this issue Jul 23, 2024
Tomas-Kraus added a commit that referenced this issue Jul 23, 2024
@m0mus m0mus added this to Backlog Aug 12, 2024
@m0mus m0mus moved this to Closed in Backlog Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues for 3.x version branch build graal webserver
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant