在 NetBeans 中使用 JDK11 启动 GlassFish 服务器 IDE

Start GlassFish server with JDK11 in NetBeans IDE

我尝试 运行 JDK11 上的 Glassfish 服务器 6.2.2 Officially supports JDK 11 on NetBeans 12.5 which itself should have Jakarta EE 9 GlassFish 6 Support。如果我启动 GlassFish,我会收到一条来自 NetBeans 的消息说

GlassFish server could not be started with JDK 11 (Default). Pleas select another Java SE Plattform.

如果我通过 asadmin 启动 GlassFish 服务器,它会很有用。所以我猜这是一个 NetBeans 问题。

是否有解决方法可以让它正常工作,或者我是否遗漏了什么?

我已阅读 which was asked only a couple of days ago and also Does GlassFish server 5.1 can started with JDK15 and also Start Glassfish in Netbeans 10 with JDK11,但它们都是关于版本 6 之前的旧 GlassFish 版本。


编辑

顺便说一句:如果我尝试使用 JDK8 启动 GlassFish 6.2.2,我会收到一条错误消息

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occured. Program will exit.
Unrecognized option: --add-opens=jdk.management/com.sun.management/com.sun.management.internal=ALL-UNNAMED

所以我根本不可能启动服务器。

虽然 Release Notes for NetBeans 12.5 state "Jakarta EE 9 GlassFish 6 Support", the information on the associated GitHub link titled "Jakarta EE 9 GlassFish 6 Support #2902" 阐明了支持的范围:

Adds support for GlassFish 6 automatic registration; Prepares for Jakarta EE 9.1 and GlassFish 6.1.0, although not yet enabled for automatic registration.

因此 NetBeans 12.5 不支持使用 Glassfish 6.2.x。请记住,NetBeans 12.5 于 9 月 13 日发布,比 Glassfish 6.2 发布早了将近三周,因此缺少支持并非没有道理。

有关为什么 GlassFish 6.2.x 不能与 NetBeans 12.5 一起工作的更多详细信息,请参阅来自 NetBeans 问题 5734: JDK-Selection for Glassfish 6.1 is restricted to JDK 1.8

的评论

Netbeans expects to have a description of every Glassfish distribution, and 6.2 has yet to be done. Unfortunately ATM when you select 6.2.x it defaults to the nearest major version which is 6.0, and JDK is therefore restricted again, which is correct in that version.

看来对 GlassFish 6 的支持。2.x 将包含在 NetBeans 12.6 中,该版本目前计划于本月晚些时候发布,即 11 月 15 日至 11 月 30 日之间的某个时间。


21 年 12 月 8 日更新:OP 已确认此问题已通过 21 年 11 月 29 日发布的 NetBeans 12.6 解决。