问题标签 [graalvm-native-image]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
796 浏览

java - 测试失败,无法找到原生镜像

我正在尝试将 Quarkus 网络服务器集成到 Gradle 多构建项目中。我一直在遵循设置 Quarkus 服务的典型指南,但遇到了一个我不知道如何解决的问题。此时我正在尝试运行默认设置(使用默认代码和测试)

运行测试时,我收到一条错误消息Unable to find native image, make sure native.image.path is set

我认为这是一个配置或依赖问题,但不知道如何解决它,因为我是 Quarkus 的新手,而且它的 Gradle 支持似乎相当缺乏......

我相信我已经正确设置了 GraalVM(使用本机映像可执行文件)。

项目,以防你想挖掘。让我知道还有什么,如果有什么可以包括在这里的话。

子项目的build.gradle:

失败消息:

0 投票
1 回答
802 浏览

quarkus - java.util.MissingResourceException:无法通过 com.sun.org.apache.xml.internal.res.XMLErrorResources 加载任何资源包

我尝试使用 quarkus/graalVM 构建一个 AWS Lambda 处理程序。处理程序应该使用队列中的 SQS 消息(而不是作为 SQSEvent)。我添加了依赖项 - quarkus-amazon-lambda - quarkus-camel-aws-sqs - quarkus-amazon-dynamodb(以获取 SSL 配置) - aws-lambda-java-events - quarkus-jaxb

我已经为 Logging 和 com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl 添加了一些反射提示,但现在我得到了关于缺少资源的上述异常。资源包也可以在反射配置中以某种方式指定,还是有其他方法可以走?

0 投票
2 回答
480 浏览

java - Can a native image generated by GraalVM replace IKVM generated DLLs?

I have some Java-app and a customer with some UWP-app implemented in C#, distributed through the Windows Store etc., who wants to use some pieces of my app. Those pieces are pretty OS-independent, only parsing of some special binary file formats, applying some business logic configured using YAML files and stuff. No network, GUI, only some accesses to files etc.

We currently use IKVM to make the code of interest available to C# but ran into different problems already. Some were supporting .NET Core, some had to do with the native toolchain in Release etc. While right now things seem to work after applying some workarounds, I'm looking for alternatives to IKVM already a bit.

The only thing I currently use of IKVM is simply creating a DLL of my code using ikvmc, which can then be referenced in the UWP-project. The compiler is summarized like the following:

The ikvmc tool converts Java bytecode to .NET dll's and exe's.

That's where the support to create native Windows images of GraalVM came into my mind. Others seem to already build native binaries for Windows and according to the docs, GraalVM is able to create shared libs using "--shared". From my understanding, IKVM implements a JVM in .NET and maps things as needed and possible. That sounds pretty much like what "Substrate VM" does in case of a native image, doesn't it?

This executable includes the application, the libraries, the JDK and does not run on the Java VM, but includes necessary components like memory management and thread scheduling from a different virtual machine, called “Substrate VM”. Substrate VM is the name for the runtime components (like the deoptimizer, garbage collector, thread scheduling etc.).

https://www.graalvm.org/docs/reference-manual/native-image/

So, is there any chance that a native image in form of a DLL can replace the DLL created by ikvmc currently? Did anyone try that already and has any experiences? Did anyone try already to create a native DLL and consume that in some other native Windows app? From my understanding UWP "only" applies additional restrictions which one might be able to work around again. Or is this approach totally impossible for some reasons?

Thanks all for your input!

0 投票
2 回答
224 浏览

graalvm - GraalVM native-image 的 -H:... 选项的文档在哪里?

GitHub 上的 Substrate VM 文档(例如CONFIGURE.md提到了多个-H:...选项,例如-H:ReflectionConfigurationResources-H:ConfigurationFileDirectories。在哪里可以找到这些选项的参考文档?GraalVM Reference > Native Image仅提供基本概述。

0 投票
1 回答
352 浏览

java - GraalVM native-image -H:ConfigurationFileDirectories 文件的文档

在哪里可以找到使用选项 - 、和设置的GraalVMnative-image配置文件的文档/架构?-H:ConfigurationFileDirectories=<dir>jni-config.jsonreflect-config.jsonproxy-config.jsonresource-config.json

0 投票
0 回答
675 浏览

java - Quarkus + Native Image 内存使用

我正在评估 Quarkus,我有一个非常简单的应用程序构建为本机映像。在应用程序中,我有 Smallreye Metrics。一切正常,但我无法推断 Smallrye 和 Docker 报告的内存使用情况。

当我运行 docker stats 时,我得到

所以 4.6MB,很酷。

当我查看 Smallrye 输出/metrics时,我看到了

这大约是 10 倍(如果我正确阅读了科学记数法)。我错过了什么?

0 投票
2 回答
1728 浏览

quarkus - 图像堆中不允许...的实例,因为此类应在图像运行时初始化

我正在使用以下堆栈运行一个简单的 Java 应用程序(只是一个 REST 端点,一个“Hello”响应——正是由 Quarkus maven 原型生成的示例,无需修改):

  • Quarkus(微配置文件)
  • JDK 1.8 热点 1.8.0_231-b11
  • GraalVM 19.3.0(本机映像)
  • macOS 卡塔利娜

它是第一个错误(尽管它似乎不是主要问题):

真正的问题(我认为)在这里:

所以,我尝试的第一件事是指示类 org.wildfly.common.net.CidrAddress 不要在 Image BuildTime 初始化,而是在 Image RunTime 初始化,配置如下:

但是,什么都没有改变。我还尝试激活(按照指示)参数 -H:+TraceClassInitialization,以找出可能导致问题的正在初始化的类。没有效果!这个参数没有任何区别(没有额外的信息)。

其他人是否经历过这种情况?任何提示,想法?

谢谢!

0 投票
1 回答
884 浏览

docker - 使用 Quarkus,我如何在 docker 镜像中构建原生镜像(使用 Kotlin 和 Gradle)

Quarkus 文档解释了如何使用 Maven 构建 docker 镜像。但我正在使用 Gradle 和 Kotlin。我试图弄清楚如何执行这些步骤:

首先,我想我想要一个有 gradle 而不是 maven 的图像(quay.io 似乎没有)。然后我必须弄清楚我还需要复制什么(而不是 pom.xml)也许build.gradlesettings.gradle? gradle.properties? 其次,我相信这个镜像也包含 GraalVM。所以我不确定我能在那里做什么。

必须使用 Maven 吗?我真的,真的不想。

0 投票
0 回答
240 浏览

java - 无法实例化 SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException):xbean.jar 的版本是否正确?

我正在编写一个将数据导出到 Excel 工作表的应用程序。

我下载了 Apache POI 库,并将以下库包含到我的项目中:- poi-4.0.1.jar

使用 graalvm 将 jar 转换为本机图像时,我收到以下运行时错误。jar 正在使用命令提示符执行。

0 投票
1 回答
969 浏览

java - 将 Apache POI 与 GraalVM 原生映像一起使用 - XMLBeans 中的 ClassCastException

使用 Apache POI 生成 Excel 工作表时出现以下错误。

代码在 Eclipse 中执行,但在转换为 GraalVM 原生映像时会出现以下错误。