Graal native image support
See original GitHub issueCurrently even with Graal snapshots it fails with following error:
mx native-image -Dio.netty.noUnsafe=true -H:ReflectionConfigurationFiles=/home/seb/workspace/spring-fu/samples/simple-webapp/graal.json -H:+ReportUnsupportedElementsAtRuntime -Dfile.encoding=UTF-8 -jar /home/seb/workspace/spring-fu/samples/simple-webapp/build/libs/simple-webapp-all.jar
classlist: 10,845.71 ms
(cap): 3,785.48 ms
setup: 7,078.43 ms
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jun 05, 2018 2:48:49 PM io.netty.util.internal.PlatformDependent <clinit>
INFO: Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
analysis: 38,365.98 ms
fatal error: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:381)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:281)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:378)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:104)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:108)
at java.lang.Class.getGenericInterfaces(Class.java:913)
at com.oracle.svm.hosted.analysis.Inflation.fillGenericInfo(Inflation.java:240)
at com.oracle.svm.hosted.analysis.Inflation.checkType(Inflation.java:148)
at java.lang.Iterable.forEach(Iterable.java:75)
at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1080)
at com.oracle.svm.hosted.analysis.Inflation.checkObjectGraph(Inflation.java:125)
at com.oracle.graal.pointsto.BigBang.checkObjectGraph(BigBang.java:582)
at com.oracle.graal.pointsto.BigBang.finish(BigBang.java:554)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:642)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:364)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image building with exit status 1
graal.json
[
{
"name" : "io.netty.channel.socket.nio.NioSocketChannel",
"methods" : [
{ "name" : "<init>", "parameterTypes" : [] }
]
},
{
"name" : "io.netty.channel.socket.nio.NioServerSocketChannel",
"methods" : [
{ "name" : "<init>", "parameterTypes" : [] }
]
}
]
We need to report this kind of issues to Graal project and provide custom spring-fu.json
reflection configuration in order to provide first class support for native images.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:18
Top Results From Across the Web
Native Image - GraalVM
Native Image supports JVM-based languages, e.g., Java, Scala, Clojure, Kotlin. The resulting image can, optionally, execute dynamic languages like ...
Read more >Native Image Support for Google Cloud Libraries - GitHub
This repository provides support for applications using the Google Java Client Libraries to be built as GraalVM Native Images. Setup. Add the native-image-...
Read more >GraalVM Native Image Support - Spring
Spring Boot includes buildpack support for native images directly for both Maven and Gradle. This means you can just type a single command...
Read more >GraalVM Native Image Support in the AWS SDK for Java 2.x
Therefore, native images are well-suited for serverless applications where startup latency is critical. We compared the startup performance of ...
Read more >Native Images with Spring Boot and GraalVM - Baeldung
The General Recursive Applicative and Algorithmic Language Virtual Machine (Graal VM) is a high-performance JDK distribution written for Java and other JVM ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Spring Fu minimal webapp is now compiling to a native image successfully with Graal 1.0.0.RC2, Kotlin 1.2.60 (will also work with 1.2.51) and Netty!!!
Startup time is 33 ms with Graal (to be compared with 900 ms with Java 10). The self-sufficient executable size is 50 MB but we will maybe be able to reduce it via #34.
Jetty also works.
I reopen this issue since https://github.com/oracle/graal/issues/655 regression makes it impossible to compile a Spring Fu webapp with Graal 1.0.0-RC6.