我正在尝试使用GraalVm编译我的一个项目,以与使用不带Graalvm的micronaut的项目进行比较。 我遵循了这个guide,但是发现了一个我不知道如何解决的问题:
13:27 $ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-20190420092731.buildslave.jdk8u-src-tar--b03)
OpenJDK GraalVM CE 19.0.0 (build 25.212-b03-jvmci-19-b01, mixed mode)
13:27 $ sdk list micronaut
================================================================================
Available Micronaut Versions
================================================================================
> * 1.1.2 1.0.0.RC1
* 1.1.1 1.0.0.M4
* 1.1.0 1.0.0.M3
1.1.0.RC2 1.0.0.M2
1.1.0.RC1 1.0.0.M1
1.1.0.M2
1.1.0.M1
1.0.5
* 1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0.RC3
1.0.0.RC2
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
13:27 $ ./gradlew clean assemble
> Task :compileJava
Note: Writing native-image.properties file to destination: META-INF/native-image/org.jlom.master_upm.tfm.graalvm.catalog.view.api/dtos/native-image.properties
Note: Writing reflection-config.json file to destination: META-INF/native-image/org.jlom.master_upm.tfm.graalvm.catalog.view.api/dtos/reflection-config.json
Note: Creating bean classes for 9 type elements
Note: /home/eojojos/sources/projects/master_upm/tfm/code/graalvm/catalog/src/main/java/org/jlom/master_upm/tfm/graalvm/catalog/model/ContentStatusJsonSerializer.java uses unchecked or u
nsafe operations.
Note: Recompile with -Xlint:unchecked for details.
BUILD SUCCESSFUL in 5s
11 actionable tasks: 11 executed
13:27 $ ./docker-build.sh [61/2720]
Sending build context to Docker daemon 84.97MB
Step 1/9 : FROM oracle/graalvm-ce:19.0.0 as graalvm
---> d413331a996d
Step 2/9 : COPY . /home/app/catalog
---> d643aadfe532
Step 3/9 : WORKDIR /home/app/catalog
---> Running in c5c8c20ee44d
Removing intermediate container c5c8c20ee44d
---> d3f62d78fafa
Step 4/9 : RUN gu install native-image
---> Running in 4d04a1aca344
Downloading: Component catalog from www.graalvm.org
Processing component archive: Native Image
Downloading: Component native-image: Native Image from github.com
Installing new component: Native Image licence files (org.graalvm.native-image, version 19.0.0)
Refreshed alternative links in /usr/bin/
Removing intermediate container 4d04a1aca344
---> 3eb8a89cd2c5
Step 5/9 : RUN native-image --no-server -cp build/libs/catalog-*.jar
---> Running in 633894f347b4
[catalog:6] classlist: 4,881.13 ms
[catalog:6] (cap): 773.43 ms
[catalog:6] setup: 1,912.13 ms
[catalog:6] analysis: 56,522.09 ms
Fatal error: java.lang.NoClassDefFoundError
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:458)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:289)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:427)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:109)
Caused by: java.lang.NoClassDefFoundError: rx/Completable
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at com.oracle.svm.core.hub.DynamicHub.initEnumConstantsAtRuntime(DynamicHub.java:390)
at com.oracle.svm.hosted.analysis.Inflation.checkType(Inflation.java:194)
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:136)
at com.oracle.graal.pointsto.BigBang.checkObjectGraph(BigBang.java:599)
at com.oracle.graal.pointsto.BigBang.finish(BigBang.java:557)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:684)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:523)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:441)
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)
Caused by: java.lang.ClassNotFoundException: rx.Completable
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 20
我认为主要问题是 java.lang.NoClassDefFoundError:rx / Completable ,但我不知道下一步该怎么做...
Here是我一直在使用的代码,没什么花哨的,只是一个简单的rest控制器->服务->存储库项目。
我可以做什么来构建本机映像?
预先感谢