我有一个用Java 11编写的小型Quarkus Web应用程序。它使用hibernate orm扩展连接到Postgres DB并执行基本CRUD操作。这些应用程序在JVM上运行良好,但容器中的本机映像生成器失败。我尝试过使用默认的builder imagequay。io/quarkus/ubi quarkus本机映像:20.1.0-java11
和心轴,但错误始终相同:
mvn clean package -DskipTests -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.example:my-project-x >------------------------
[INFO] Building my-project-x 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ my-project-x ---
[INFO] Deleting /home/user-x/IdeaProjects/project-xyz/target
[INFO]
[INFO] --- quarkus-maven-plugin:1.7.1.Final:prepare (default) @ my-project-x ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ my-project-x ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ my-project-x ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 28 source files to /home/user-x/IdeaProjects/project-xyz/target/classes
[INFO]
[INFO] --- quarkus-maven-plugin:1.7.1.Final:prepare-tests (default) @ my-project-x ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ my-project-x ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/user-x/IdeaProjects/project-xyz/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ my-project-x ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/user-x/IdeaProjects/project-xyz/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ my-project-x ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-project-x ---
[INFO] Building jar: /home/user-x/IdeaProjects/project-xyz/target/my-project-x-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:1.7.1.Final:build (default) @ my-project-x ---
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.19.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /home/user-x/IdeaProjects/project-xyz/target/my-project-x-1.0.0-SNAPSHOT-native-image-source-jar/my-project-x-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /home/user-x/IdeaProjects/project-xyz/target/my-project-x-1.0.0-SNAPSHOT-native-image-source-jar/my-project-x-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Checking image status quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11
20.1-java11: Pulling from quarkus/ubi-quarkus-mandrel
57de4da701b5: Already exists
cf0f3ebe9f53: Already exists
cb972249a74f: Pull complete
Digest: sha256:bc5a542165aef56c2974e9478c4a53ed5445884be0cf2044a215618cfdc8f004
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11
quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0.1.Final 287bbb343e (Mandrel Distribution) (Java Version 11.0.8)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /home/user-x/IdeaProjects/project-xyz/target/my-project-x-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --user 1001:1001 --rm quay.io/quarkus/ubi-quarkus-mandrel:20.1-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar my-project-x-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:-UseServiceLoaderFeature -H:+StackTrace my-project-x-1.0.0-SNAPSHOT-runner
[my-project-x-1.0.0-SNAPSHOT-runner:54] classlist: 9,079.72 ms, 1.68 GB
[my-project-x-1.0.0-SNAPSHOT-runner:54] (cap): 645.81 ms, 1.68 GB
[my-project-x-1.0.0-SNAPSHOT-runner:54] setup: 1,980.99 ms, 1.68 GB
21:55:42,006 INFO [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.1.5.Final
21:55:42,139 INFO [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.19.Final
21:55:42,143 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
21:55:42,168 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
21:55:42,214 INFO [org.hib.orm.beans] HHH10005002: No explicit CDI BeanManager reference was passed to Hibernate, but CDI is available on the Hibernate ClassLoader.
21:56:01,321 INFO [org.jbo.threads] JBoss Threads version 3.1.1.Final
[my-project-x-1.0.0-SNAPSHOT-runner:54] analysis: 39,734.17 ms, 5.07 GB
2 fatal errors detected:
Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.Class_getNestHost_d0409f1154f6242e625526eadd05fbcd60e7d7e9.invoke(java.lang.Object, java.lang.Object[])
Parsing context:
parsing java.base@11.0.8/java.lang.reflect.Method.invoke(Method.java:566)
parsing javax.enterprise.util.AnnotationLiteral.invoke(AnnotationLiteral.java:288)
parsing javax.enterprise.util.AnnotationLiteral.getMemberValue(AnnotationLiteral.java:276)
parsing javax.enterprise.util.AnnotationLiteral.hashCode(AnnotationLiteral.java:246)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.getHashIndex(EconomicMapImpl.java:414)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.findHash(EconomicMapImpl.java:285)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.find(EconomicMapImpl.java:254)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.put(EconomicMapImpl.java:426)
parsing platform/jdk.internal.vm.compiler/org.graalvm.compiler.options.ModifiableOptionValues.update(ModifiableOptionValues.java:103)
parsing app//com.oracle.svm.core.option.RuntimeOptionParser.parse(RuntimeOptionParser.java:174)
parsing app//com.oracle.svm.core.option.RuntimeOptionParser.parseAndConsumeAllOptions(RuntimeOptionParser.java:77)
parsing app//com.oracle.svm.jni.functions.JNIInvocationInterface$Exports.JNI_CreateJavaVM(JNIInvocationInterface.java:151)
parsing com.oracle.svm.core.code.IsolateEnterStub.JNIInvocationInterface$Exports_JNI_CreateJavaVM_8df18e9ea6eb1ed7b1c899a0bbc578da0e2cc0ad(generated:0)
at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:340)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:311)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:112)
at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:228)
at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:530)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getNestHost() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:183)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:397)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:377)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:75)
at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:511)
at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:333)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:189)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:352)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:322)
... 13 more
Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.Class_getNestHost_d0409f1154f6242e625526eadd05fbcd60e7d7e9.invoke(java.lang.Object, java.lang.Object[])
Parsing context:
parsing java.base@11.0.8/java.lang.reflect.Method.invoke(Method.java:566)
parsing javax.enterprise.util.AnnotationLiteral.invoke(AnnotationLiteral.java:288)
parsing javax.enterprise.util.AnnotationLiteral.getMemberValue(AnnotationLiteral.java:276)
parsing javax.enterprise.util.AnnotationLiteral.hashCode(AnnotationLiteral.java:246)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.getHashIndex(EconomicMapImpl.java:414)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.findHash(EconomicMapImpl.java:285)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.find(EconomicMapImpl.java:254)
parsing app/org.graalvm.sdk/org.graalvm.collections.EconomicMapImpl.put(EconomicMapImpl.java:426)
parsing platform/jdk.internal.vm.compiler/org.graalvm.compiler.options.ModifiableOptionValues.update(ModifiableOptionValues.java:103)
parsing app//com.oracle.svm.core.option.RuntimeOptionParser.parse(RuntimeOptionParser.java:174)
parsing app//com.oracle.svm.core.option.RuntimeOptionParser.parseAndConsumeAllOptions(RuntimeOptionParser.java:77)
parsing app//com.oracle.svm.jni.functions.JNIInvocationInterface$Exports.JNI_CreateJavaVM(JNIInvocationInterface.java:151)
parsing com.oracle.svm.core.code.IsolateEnterStub.JNIInvocationInterface$Exports_JNI_CreateJavaVM_8df18e9ea6eb1ed7b1c899a0bbc578da0e2cc0ad(generated:0)
at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:340)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:311)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:112)
at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:228)
at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:530)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getNestHost() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:183)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:397)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:377)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:75)
at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:511)
at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:333)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:189)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:352)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:322)
... 13 more
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ----------------------------
后来我决定直接用GraalVM编译它。我下载了graalvm-ce-java11-20.2.0
,安装了本机映像扩展,相应地设置了JAVA_HOME,它编译起来没有任何抱怨,本机可执行文件运行得很好。尽管如此,我还是想在一个docker容器中编译,而不必安装GraalVM。
环境:
Quarkus1.7.1决赛
$ echo $JAVA_HOME
/opt/jdk-14/
$ java -version
openjdk version "14" 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)
波姆。xml:
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
更新:我刚刚单独运行了docker run
命令,并添加了-H:reportunsupportedelementsatluntime
,这次错误消息不那么模糊:
Caused by: java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
在尝试构建容器时,您是否使用Java 11编译应用程序?
因为它看起来很像我们在使用JDK 8编译应用程序,然后使用GraalVM/心轴Java 11容器构建应用程序时遇到的问题。
我想使用pyInstaller的单文件夹模式,但我不想每次都收集所有依赖项。 大多数情况下,我可以重用它以前打包的所有依赖项,我只需要可执行文件,我想如果我能在构建过程中尽快停止,我会在构建过程中节省10~20分钟。exe文件已生成。 我知道用-F标志将所有依赖项打包到一个可执行文件中,但这不是我想要的。我只希望pyInstaller在打包步骤之前停止。 我希望生成在可能输出时立即停止:
问题内容: 我在XP上使用python 2.6。我刚刚安装了py2exe,并且可以从hello.py成功创建一个简单的hello.exe。但是,当我尝试在实际程序上使用py2exe时,py2exe会生成一些信息消息,但无法在dist文件夹中生成任何内容。 我的setup.py看起来像这样: 和py2exe输出看起来像这样: py2exe似乎已经找到了我的所有导入文件(尽管看到win32时我感到有些
我目前正在阅读Spring Boot的教程页(https://Spring.io/guides/gs/uploading-files/#initial),以便检查如何上传映像文件,但我不太理解“运行应用程序”一章的“构建可执行JAR”部分。 我通过教程页面上的链接下载了该项目,并复制和粘贴了所有文件,我在命令提示符上编写了,就像在构建页面中编写的可执行JAR部分一样,但我无法运行该程序。 为了更具
我在Netbeans中创建了一个java项目,现在正处于构建阶段。我的项目中的所有东西都设置好了,我在它的属性中设置了一个主类,我甚至将我的项目设置为主项目。当我进行“清理和构建”时,会用我的。jar文件创建一个dist文件夹。但是,.jar文件是不可执行的,为什么呢?我打开了。jar文件并查看了清单,指定了一个main类,那么有什么问题呢?我运行的是Netbeans 7.3.1。谢了。
我试图编译一个“su”超级用户实用程序的修改版本,所以我在git上访问了android5.0源代码,得到了“su.c”文件。 我的实际设备/硬件是一部运行以下功能的乐视x500手机: Android 5.0.2,SDK 21 CPU架构AArch64处理器版本2 指令集arm64-v8a 我是关于硬件数据,因为我已经检查了制造商的网站 使用cygwin shell: $sh制作独立的工具链。sh-