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

4.x: Cannot create native image unless helidon-http-media-jsonp is present on classpath #7984

Closed
SentryMan opened this issue Nov 10, 2023 · 1 comment · Fixed by #8044
Closed
Assignees
Labels
4.x Version 4.x bug Something isn't working native-image P2 SE
Milestone

Comments

@SentryMan
Copy link

Environment Details

  • Helidon Version: 4.0.0
  • Helidon SE
  • JDK version:
openjdk 21.0.1 2023-10-17
OpenJDK Runtime Environment GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
  • OS: Windows 10
  • Docker version 4.25.0:

Problem Description

It seems that unless I add

        <dependency>
            <groupId>io.helidon.http.media</groupId>
            <artifactId>helidon-http-media-jsonp</artifactId>
        </dependency>

To my pom file, I cannot compile a native image using the autoconfigured plugins from the below parent.

    <parent>
        <groupId>io.helidon.applications</groupId>
        <artifactId>helidon-se</artifactId>
        <version>4.0.0</version>
        <relativePath/>
    </parent>

Full error:

Error: Classes that should be initialized at run time got initialized during image building:
 jakarta.json.JsonArray was unintentionally initialized at build time. To see why jakarta.json.JsonArray got initialized use --trace-class-initialization=jakarta.json.JsonArray
org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$2 was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$2 got initialized use --trace-class-initialization=org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$2
org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$1 was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$1 got initialized use --trace-class-initialization=org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$1
org.eclipse.parsson.JsonTokenizer$JsonToken was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonTokenizer$JsonToken got initialized use --trace-class-initialization=org.eclipse.parsson.JsonTokenizer$JsonToken
jakarta.json.JsonValueImpl was unintentionally initialized at build time. To see why jakarta.json.JsonValueImpl got initialized use --trace-class-initialization=jakarta.json.JsonValueImpl
org.eclipse.parsson.JsonParserImpl$4 was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonParserImpl$4 got initialized use --trace-class-initialization=org.eclipse.parsson.JsonParserImpl$4
org.eclipse.parsson.JsonObjectBuilderImpl$JsonObjectImpl was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonObjectBuilderImpl$JsonObjectImpl got initialized use --trace-class-initialization=org.eclipse.parsson.JsonObjectBuilderImpl$JsonObjectImpl
org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$3 was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$3 got initialized use --trace-class-initialization=org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$3
org.eclipse.parsson.JsonProviderImpl was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonProviderImpl got initialized use --trace-class-initialization=org.eclipse.parsson.JsonProviderImpl
org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl got initialized use --trace-class-initialization=org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl
jakarta.json.JsonValue was unintentionally initialized at build time. To see why jakarta.json.JsonValue got initialized use --trace-class-initialization=jakarta.json.JsonValue
org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy got initialized use --trace-class-initialization=org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy
jakarta.json.EmptyObject was unintentionally initialized at build time. To see why jakarta.json.EmptyObject got initialized use --trace-class-initialization=jakarta.json.EmptyObject
jakarta.json.JsonStructure was unintentionally initialized at build time. To see why jakarta.json.JsonStructure got initialized use --trace-class-initialization=jakarta.json.JsonStructure
jakarta.json.spi.JsonProvider was unintentionally initialized at build time. To see why jakarta.json.spi.JsonProvider got initialized use --trace-class-initialization=jakarta.json.spi.JsonProvider
org.eclipse.parsson.UnicodeDetectingInputStream was unintentionally initialized at build time. To see why org.eclipse.parsson.UnicodeDetectingInputStream got initialized use --trace-class-initialization=org.eclipse.parsson.UnicodeDetectingInputStream
jakarta.json.EmptyArray was unintentionally initialized at build time. To see why jakarta.json.EmptyArray got initialized use --trace-class-initialization=jakarta.json.EmptyArray
org.eclipse.parsson.JsonContext was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonContext got initialized use --trace-class-initialization=org.eclipse.parsson.JsonContext
org.eclipse.parsson.JsonStringImpl was unintentionally initialized at build time. To see why org.eclipse.parsson.JsonStringImpl got initialized use --trace-class-initialization=org.eclipse.parsson.JsonStringImpl
To see how the classes got initialized, use --trace-class-initialization=jakarta.json.JsonArray,org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$2,org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$1,org.eclipse.parsson.JsonTokenizer$JsonToken,jakarta.json.JsonValueImpl,org.eclipse.parsson.JsonParserImpl$4,org.eclipse.parsson.JsonObjectBuilderImpl$JsonObjectImpl,org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy$3,org.eclipse.parsson.JsonProviderImpl,org.eclipse.parsson.JsonArrayBuilderImpl$JsonArrayImpl,jakarta.json.JsonValue,org.eclipse.parsson.JsonObjectBuilderImpl$DuplicateStrategy,jakarta.json.EmptyObject,jakarta.json.JsonStructure,jakarta.json.spi.JsonProvider,org.eclipse.parsson.UnicodeDetectingInputStream,jakarta.json.EmptyArray,org.eclipse.parsson.JsonContext,org.eclipse.parsson.JsonStringImpl

Steps to reproduce

  1. Go to the helidon-se branch of this repo
  2. go to the helidon-se directory
  3. remove the jsonp dependency
  4. run docker build -f Dockerfile.native -t hello .
@romain-grecourt
Copy link
Contributor

helidon-security-providers-jwt depends on helidon-security-jwt which depends on parsson.

helidon-http-media-jsonp includes native-image configuration:

Args=--initialize-at-build-time=org.eclipse.parsson --initialize-at-build-time=jakarta.json

This is a bug as the native-image configuration for parsson / json-p should be included regardless of helidon-http-media-jsonp.

As a workaround you can include the options listed above in your own native-image.properties.

@romain-grecourt romain-grecourt added native-image SE 4.x Version 4.x bug Something isn't working labels Nov 13, 2023
@m0mus m0mus added the P2 label Nov 13, 2023
@barchetta barchetta added this to the 4.0.1 milestone Nov 20, 2023
@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
4.x Version 4.x bug Something isn't working native-image P2 SE
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants