Closed ebremer closed 2 years ago
If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.
The project builds an embedded Keycloak server using Spring Boot.
git clone https://github.com/ebremer/embedded-spring-boot-keycloak-server.git
cd embedded-spring-boot-keycloak-server
git checkout nativebuild
mvn -X -DskipTests -Pundertow clean install
cd embedded-keycloak-server-plain
mvn -X -DskipTests -Pnative clean package
then run "target\keycloak" Under Ubuntu 20, it will build and then running it will generate the error:
[java.lang.NoSuchMethodError: io.undertow.util.FastConcurrentDirectDeque.<init>()](https://github.com/spring-projects-experimental/spring-native/issues/1576#)
Under Windows 11, the build fails with the following error:
========================================================================================================================
GraalVM Native Image: Generating 'keycloak'...
========================================================================================================================
[1/7] Initializing... (13.4s @ 0.21GB)
Warning: Could not register org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension: allPublicMethods for reflection. Reason: java.lang.NoClassDefFoundError: reactor/core/publisher/Mono.
Version info: 'GraalVM 22.0.0.2 Java 17 CE'
[2/7] Performing analysis... [*********] (65.5s @ 5.72GB)
10:46:00.457 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
Warning: Could not register complete reflection metadata for org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator. Reason(s): java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
Warning: Could not register complete reflection metadata for org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension. Reason(s): java.lang.NoClassDefFoundError: reactor/core/publisher/Mono
Warning: Could not register complete reflection metadata for org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator. Reason(s): java.lang.NoClassDefFoundError: org/aspectj/util/PartialOrder$PartialComparable
Warning: Could not register complete reflection metadata for io.undertow.protocols.alpn.JettyAlpnProvider. Reason(s): java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/ALPN$ClientProvider
26,836 (91.67%) of 29,274 classes reachable
45,955 (80.58%) of 57,032 fields reachable
129,391 (62.78%) of 206,108 methods reachable
1,118 classes, 362 fields, and 4,100 methods registered for reflection
82 classes, 78 fields, and 67 methods registered for JNI access
[3/7] Building universe... (4.7s @ 4.20GB)
[4/7] Parsing methods... [*] (1.4s @ 6.42GB)
[5/7] Inlining methods... [*****] (4.9s @ 4.99GB)
[6/7] Compiling methods... [****] (15.7s @ 5.84GB)
[7/7] Creating image...
Fatal error: com.oracle.svm.core.util.VMError$HostedError: should not reach here
at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:64)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLL(JNIRegistrationSupport.java:256)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLLs(JNIRegistrationSupport.java:230)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.afterImageWrite(JNIRegistrationSupport.java:175)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$8(NativeImageGenerator.java:680)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:680)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
------------------------------------------------------------------------------------------------------------------------
12.4s (10.3% of total time) in 78 GCs | Peak RSS: 11.12GB | CPU load: 8.51
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
D:\projects\embedded-spring-boot-keycloak-server\embedded-keycloak-server-plain\target\keycloak.exe (executable)
D:\projects\embedded-spring-boot-keycloak-server\embedded-keycloak-server-plain\target\awt.dll (jdk_lib)
D:\projects\embedded-spring-boot-keycloak-server\embedded-keycloak-server-plain\target\javajpeg.dll (jdk_lib)
D:\projects\embedded-spring-boot-keycloak-server\embedded-keycloak-server-plain\target\lcms.dll (jdk_lib)
D:\projects\embedded-spring-boot-keycloak-server\embedded-keycloak-server-plain\target\keycloak.build_artifacts.txt
========================================================================================================================
Failed generating 'keycloak' after 1m 59s.
closing this issue as I found multiple mistakes on my part with supported versions. I'm getting a new error which is consistent on both windows and linux builds, but I will open up a new issue if I cannot resolve it myself.
Seems like we are missing some configuration for undertow.
Yeah this is expected, only Tomcat is supported for now, see #249 related issue and support documentation.
This should probably fixed in Spring Boot 3 timeframe, so I will close this issue as duplicate of #249.
I was able to compile a Spring Boot Project of mine that uses Undertow.
Spring 2.6.6. spring-aot-maven-plugin 0.11.4 native-maven-plugin 0.9.11
During compiling, the following was issued: