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

Cannot create native executable for application with JPA on Windows (Helidon framework) #5353

Closed
szachmati opened this issue Nov 3, 2022 · 2 comments

Comments

@szachmati
Copy link

szachmati commented Nov 3, 2022

Describe the issue
Hello, I created Helidon MP application for CRUD functionality using JPA 3.0 Jakarta integration with Hibernate. Everything works fine during standard building with helidon dev and mvn clean package. The problem occurs while trying to build application as a native executable using GraalVM.

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. Download application available at https://github.com/szachmati/product-api/tree/master/helidon
  2. Run mvn clean package -DskipTests -Pnative-image command in x64 Native Tools Command Prompt(Windows)
  3. See logs

Describe GraalVM and your environment:

  • Helidon Version: 3.0.2
  • Helidon MP
  • JDK version: 17
  • GraalVM version: 22.3.0 Java 17 CE
  • OS: Windows 10
  • Docker version (if applicable): 20.10.11

More details

[INFO] Copying helidon-mp-graal-native-image-extension-3.0.2.jar to E:\studia\WIT\sem4\magisterka\shop\helidon\target\libs\helidon-mp-graal-native-image-extension-3.0.2.jar
[INFO] Copying helidon-graal-native-image-extension-3.0.2.jar to E:\studia\WIT\sem4\magisterka\shop\helidon\target\libs\helidon-graal-native-image-extension-3.0.2.jar
[INFO]
[INFO] --- helidon-maven-plugin:3.0.0:report (third-party-license-report) @ shop ---
[INFO] Scanning shop
[INFO] Reading input from HELIDON_THIRD_PARTY_LICENSES.xml on classpath
[INFO] Writing output to E:\studia\WIT\sem4\magisterka\shop\helidon\target\HELIDON_THIRD_PARTY_LICENSES.txt
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ shop ---
[INFO] Building jar: E:\studia\WIT\sem4\magisterka\shop\helidon\target\shop.jar
[INFO]
[INFO] --- helidon-maven-plugin:3.0.0:native-image (native-image) @ shop ---
[INFO] Building native image :E:\studia\WIT\sem4\magisterka\shop\helidon\target\shop
[WARNING] Warning: Ignoring server-mode native-image argument --no-server.
[WARNING] Warning: Using a deprecated option --allow-incomplete-classpath from 'META-INF\native-image\io.helidon.webserver\helidon-webserver\native-image.properties' in 'file:///E:/studia/WIT/sem4/magisterka/shop/helidon/target/libs/helidon-webserver-3.0.2.jar'. Allowing an incomplete classpath is now the default. Use --link-at-build-time to report linking errors at image build time for a class or package.
[WARNING] Warning: Option 'EnableAllSecurityServices' is deprecated and might be removed from future versions
[INFO] ========================================================================================================================
[INFO] GraalVM Native Image: Generating 'shop' (executable)...
[INFO] ========================================================================================================================
[WARNING] --initialize-at-build-time without arguments has been deprecated when not using --diagnostics-mode. With GraalVM 22.0.0 --initialize-at-build-time will only work with --diagnostics-mode for debugging purposes.
[WARNING] The reason for deprecation is that --initalize-at-build-time does not compose, i.e., a single library can make assumptions that the whole classpath can be safely initialized at build time; that assumption is often incorrect.
[INFO] 2022.11.01 23:33:25 INFO io.helidon.common.LogConfig Thread[main,5,main]: Logging at initialization configured using classpath: /logging.properties
[INFO] 2022.11.01 23:33:25 INFO org.hibernate.validator.internal.util.Version Thread[main,5,main]: HV000001: Hibernate Validator 7.0.2.Final
[INFO] Warning: Feature class io.helidon.integrations.graal.mp.nativeimage.extension.WeldFeature is annotated with the deprecated annotation @AutomaticFeature. Support for this annotation will be removed in a future version of GraalVM. Applications should register a feature using the option --features=io.helidon.integrations.graal.mp.nativeimage.extension.WeldFeature
[WARNING] Warning: Could not resolve org.hibernate.annotations.common.util.impl.Log_$logger for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.annotations.common.util.impl.Log_$logger.
[WARNING] Warning: Could not resolve org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.
[WARNING] Warning: Could not resolve org.hibernate.jmx.internal.DisabledJmxServiceImpl for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.jmx.internal.DisabledJmxServiceImpl.
[WARNING] Warning: Could not resolve org.hibernate.tool.hbm2ddl.SingleLineSqlCommandExtractor for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.tool.hbm2ddl.SingleLineSqlCommandExtractor.
[WARNING] Warning: Could not resolve org.hibernate.tuple.entity.PojoEntityTuplizer for reflection configuration. Reason: java.lang.ClassNotFoundException: org.hibernate.tuple.entity.PojoEntityTuplizer.
[INFO] [1/7] Initializing...                                                                                   (23,2s @ 0,52GB)
[INFO]  Version info: 'GraalVM 22.3.0 Java 17 CE'
[INFO]  Java version info: '17.0.5+8-jvmci-22.3-b08'
[INFO]  C compiler: cl.exe (microsoft, x64, 19.33.31629)
[INFO]  Garbage collector: Serial GC
[INFO]  2 user-specific feature(s)
[INFO]  - io.helidon.integrations.graal.mp.nativeimage.extension.WeldFeature
[INFO]  - io.helidon.integrations.graal.nativeimage.extension.HelidonReflectionFeature
[INFO] 2022.11.01 23:33:37 WARNING io.helidon.common.HelidonFeatures Thread[main,5,main]: Feature 'Hibernate' for path 'JPA/Hibernate' has limited support in native image: Experimental support, tested on limited use cases
[INFO] 2022.11.01 23:33:37 WARNING io.helidon.common.HelidonFeatures Thread[main,5,main]: Feature 'JTA' for path 'JTA' has limited support in native image: Experimental support, tested on limited use cases
[INFO]
[WARNING] Fatal error: java.lang.IllegalAccessError: class io.helidon.integrations.graal.nativeimage.extension.HelidonReflectionFeature (in unnamed module @0x4116f66a) cannot access class com.oracle.svm.core.jdk.Resources (in module org.graalvm.nativeimage.builder) because module org.graalvm.nativeimage.builder does not export com.oracle.svm.core.jdk to unnamed module @0x4116f66a
[INFO] ------------------------------------------------------------------------------------------------------------------------
[WARNING]       at io.helidon.integrations.graal.nativeimage.extension.HelidonReflectionFeature.lambda$processEntity$32(HelidonReflectionFeature.java:283)
[WARNING]       at java.base/java.lang.Iterable.forEach(Iterable.java:75)
[INFO]                         0,8s (2,1% of total time) in 13 GCs | Peak RSS: 1,30GB | CPU load: 1,38
[WARNING]       at io.helidon.integrations.graal.nativeimage.extension.HelidonReflectionFeature.processEntity(HelidonReflectionFeature.java:279)
[INFO] ========================================================================================================================
[WARNING]       at io.helidon.integrations.graal.nativeimage.extension.HelidonReflectionFeature.beforeAnalysis(HelidonReflectionFeature.java:114)
[INFO] Failed generating 'shop' after 25,3s.
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:736)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:85)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:736)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:578)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
[WARNING]       at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[WARNING] Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  46.603 s
[INFO] Finished at: 2022-11-01T23:33:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.helidon.build-tools:helidon-maven-plugin:3.0.0:native-image (native-image) on project shop: Image generation failed, exit code: 1 -> [Help 1]
[ERROR]

I reported same issue for guys in Helidon project helidon-io/helidon#5299

@szachmati szachmati changed the title Cannot create native executable for application with JPA on Windows Cannot create native executable for application with JPA on Windows (Helidon framework) Nov 3, 2022
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Nov 9, 2022
@oubidar-Abderrahim
Copy link
Member

Hi, Thank you for reaching out about this issue. Could you please add the following as a build argument for the native image: --add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED?

@oubidar-Abderrahim
Copy link
Member

This is not an actual bug, but instead, a compatibility issue between Helidon and GraalVM 22.3. this is being fixed in helidon-io/helidon#5308

Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants