Closed gtiwari333 closed 1 year ago
Also, I will get the similar error from another class com.rometools.rome.feed.WireFeed after I add kotlinx-serialization-core-jvm
New error:
Fatal error: java.lang.TypeNotPresentException: Type com.rometools.rome.feed.WireFeed not present
This goes away after I add the following dependency and finally the native executable is generated and runs without any error.
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.18.0</version>
</dependency>
Full stacktrace:
[2/7] Performing analysis... [**] (24.0s @ 1.76GB)
15,224 (93.01%) of 16,368 classes reachable
24,824 (68.21%) of 36,391 fields reachable
71,796 (66.93%) of 107,270 methods reachable
781 classes, 145 fields, and 2,712 methods registered for reflection
Fatal error: java.lang.TypeNotPresentException: Type com.rometools.rome.feed.WireFeed not present
at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at java.base/sun.reflect.generics.reflectiveObjects.LazyReflectiveObjectGenerator.reifyBounds(LazyReflectiveObjectGenerator.java:65)
at java.base/sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getBounds(TypeVariableImpl.java:125)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionDataBuilder.makeTypeReachable(ReflectionDataBuilder.java:521)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionDataBuilder.makeTypeReachable(ReflectionDataBuilder.java:529)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionDataBuilder.registerTypesForClass(ReflectionDataBuilder.java:412)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionDataBuilder.processMethodMetadata(ReflectionDataBuilder.java:267)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionDataBuilder.duringAnalysis(ReflectionDataBuilder.java:187)
at org.graalvm.nativeimage.builder/com.oracle.svm.reflect.hosted.ReflectionFeature.duringAnalysis(ReflectionFeature.java:238)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:734)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:78)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:734)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis.runAnalysis(PointsToAnalysis.java:755)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:731)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:564)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Caused by: java.lang.ClassNotFoundException: com.rometools.rome.feed.WireFeed
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
... 20 more
Spring Boot 3 requires GraalVM 22.3, you can download the Liberica NIK distribution on https://bell-sw.com/pages/downloads/native-image-kit/#/nik-22-17-ea or SDKman. You are probably using an earlier version, so please upgrade.
Please also notice this issue tracker is about Spring Native experimental project, not Spring Boot.
See this: https://github.com/gtiwari333/spring-native-error/tree/class-not-found-kotlinx-serialization-stringformat (class-not-found-kotlinx-serialization-stringformat branch)
Ive a simple setup with just
spring-boot-starter-web
dependency with Spring Boot 3.0.0-RC1 and im getting following error during native image build:./mvnw native:compile -Pnative
Fatal error: java.lang.TypeNotPresentException: Type kotlinx.serialization.StringFormat not present
It goes away if i manually add the following dependency:
I'm using GraalVM CE 22.2.0.
Full stacktrace: