Payara 服务器不适用于 Netbeans 12.6 和 JDK 17

Payara Server does not work with Netbeans 12.6 and JDK 17

我们正在公司迁移使用 java 1.7 的网络应用程序。然后我们选择使用最新稳定版本的 JDK 17 和 Payara 服务器(我们已经使用 Glassfish),但是当在 NetBeans 上链接服务器时,Java 17 LTS 平台似乎没有被选中服务器属性。有人经历过吗?

我在添加 Payara 服务器时遇到了与您相同的问题:JDK 17 没有作为 Payara 的平台提供,尽管 NetBeans 运行 在 JDK 17 上运行良好。 Java SE Platform window 甚至明确地给了我错误 Payara server could not be started with JDK 17 (Default) .请 select 另一个 Java SE 平台。 启动 Payara 时。

我没有真正的解决方案,但一个简单的解决方法是在 NetBeans 中添加 JDK 11 作为第二个 Java 平台(工具 > Java 平台 > 添加平台...),然后 select JDK 11。 Payara 在 JDK 11:

下运行良好

之后,在服务器启动后转到 http://localhost:4848/(或您选择的任何替代端口)以验证 Payara 是否正常工作:

备注:

  1. 您只能为 Payara 使用 LTS 版本,这意味着您目前唯一的 JDK 选项是 8、11 和 17。有关详细信息,请参阅 Why Payara Platform Only Supports LTS Versions of JDK
  2. 我select编辑了提供的最新版本的 Payara:5.2021.9
  3. 我不知道为什么 Payara 无法使用 JDK 17 启动,即使 NetBeans 本身在 JDK 17 上是 运行,但我怀疑它可能是相关的NetBeans 12.6 只为 JDK 17 提供 “实验性支持”。尽管 you will have to register first.
  4. ,您可以通过创建 NetBeans 错误报告来实现这一点
  5. 仅供参考,我已将 Payara 服务器日志的内容粘贴在下方,以防您仍有问题:

INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner. Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@537969f1 in service registry. #!## LogManagerService.postConstruct : rootFolder=C:\Payara\glassfish #!## LogManagerService.postConstruct : templateDir=C:\Payara\glassfish\lib\templates #!## LogManagerService.postConstruct : src=C:\Payara\glassfish\lib\templates\logging.properties #!## LogManagerService.postConstruct : dest=C:\Payara\glassfish\domains\domain1\config\logging.properties
Running Payara Version: Payara Server 5.2021.9 #badassfish (build 878)|#] Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter|#] Registered fish.payara.ha.hazelcast.store.HazelcastBackingStoreFactoryProxy for persistence-type = hazelcast in BackingStoreFactoryRegistry|#]
Hazelcast Instance Bound to JNDI at payara/Hazelcast|#] JSR107 Caching Provider Bound to JNDI at payara/CachingProvider|#] JSR107 Default Cache Manager Bound to JNDI at payara/CacheManager|#]
Network Listener http-listener-1 started in: 4ms - bound to [/0.0.0.0:8080]|#] HV000001: Hibernate Validator 6.1.5.Final|#]
Network Listener http-listener-2 started in: 1ms - bound to [/0.0.0.0:8181]|#] Network Listener admin-listener started in: 2ms - bound to [/0.0.0.0:4848]|#] Grizzly 2.4.4 started in: 5,262ms - bound to [http-listener-1:8080, http-listener-2:8181, admin-listener:4848]|#] Network Listener iiop-service started in: 2ms - bound to [/0.0.0.0:3700]|#] Payara Server 5.2021.9 #badassfish (878) startup time : Felix (2,025ms), startup services(6,171ms), total(8,196ms)|#] Data Grid Status Payara Data Grid State: DG Version: 4 DG Name: development DG Size: 1 Instances: { DataGrid: development Name: server Lite: false This: true UUID: ffa0f7cb-6228-45bd-a4a0-21e098f4bef9 Address: /192.168.50.15:4900 }|#] Payara Notification Service bootstrapped.|#] Bootstrapping Monitoring Console Runtime|#] Starting monitoring data collection for server|#] Starting monitoring watch collection for server|#]
Network Listener JMS_PROXY_default_JMS_host started in: 2ms - bound to [/0.0.0.0:7676]|#] JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://0.0.0.0:8686/jndi/rmi://0.0.0.0:8686/jmxrmi|#]
GlassFishORBFactory service initialized.|#] Listening to REST requests at context: /management/domain.|#] Skipping registration of inhabitant for service reference [org.osgi.service.metatype.MetaTypeProvider] as the service object could not be obtained.|#] Java security manager is disabled.|#]
Entering Security Startup Service.|#] Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.|#] Security Service(s) started successfully.|#] Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080|#] Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181|#] Created HTTP listener admin-listener on host/port 0.0.0.0:4848|#] Created virtual server server|#] Created virtual server __asadmin|#] Virtual server server loaded default web module |#] Loading application __admingui done in 1,757 ms|#] Initializing Mojarra |version.string| for context ''|#] Loading application [__admingui] at [/]|#] Context path from ServletContext: differs from path from bundle: /|#]
Redirecting to /common/version.jsf|#] Admin Console: Initializing Session Attributes...|#]

INFO: Create bundle provisioner class = class com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner. Registered com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishRuntime@537969f1 in service registry. #!## LogManagerService.postConstruct : rootFolder=C:\Payara\glassfish #!## LogManagerService.postConstruct : templateDir=C:\Payara\glassfish\lib\templates #!## LogManagerService.postConstruct : src=C:\Payara\glassfish\lib\templates\logging.properties #!## LogManagerService.postConstruct : dest=C:\Payara\glassfish\domains\domain1\config\logging.properties
Running Payara Version: Payara Server 5.2021.9 #badassfish (build 878)|#] Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter|#] Registered fish.payara.ha.hazelcast.store.HazelcastBackingStoreFactoryProxy for persistence-type = hazelcast in BackingStoreFactoryRegistry|#]
Hazelcast Instance Bound to JNDI at payara/Hazelcast|#] JSR107 Caching Provider Bound to JNDI at payara/CachingProvider|#] JSR107 Default Cache Manager Bound to JNDI at payara/CacheManager|#]
Network Listener http-listener-1 started in: 4ms - bound to [/0.0.0.0:8080]|#] HV000001: Hibernate Validator 6.1.5.Final|#]
Network Listener http-listener-2 started in: 1ms - bound to [/0.0.0.0:8181]|#] Network Listener admin-listener started in: 2ms - bound to [/0.0.0.0:4848]|#] Grizzly 2.4.4 started in: 5,262ms - bound to [http-listener-1:8080, http-listener-2:8181, admin-listener:4848]|#] Network Listener iiop-service started in: 2ms - bound to [/0.0.0.0:3700]|#] Payara Server 5.2021.9 #badassfish (878) startup time : Felix (2,025ms), startup services(6,171ms), total(8,196ms)|#] Data Grid Status Payara Data Grid State: DG Version: 4 DG Name: development DG Size: 1 Instances: { DataGrid: development Name: server Lite: false This: true UUID: ffa0f7cb-6228-45bd-a4a0-21e098f4bef9 Address: /192.168.50.15:4900 }|#] Payara Notification Service bootstrapped.|#] Bootstrapping Monitoring Console Runtime|#] Starting monitoring data collection for server|#] Starting monitoring watch collection for server|#]
Network Listener JMS_PROXY_default_JMS_host started in: 2ms - bound to [/0.0.0.0:7676]|#] JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://0.0.0.0:8686/jndi/rmi://0.0.0.0:8686/jmxrmi|#]
GlassFishORBFactory service initialized.|#] Listening to REST requests at context: /management/domain.|#] Skipping registration of inhabitant for service reference [org.osgi.service.metatype.MetaTypeProvider] as the service object could not be obtained.|#] Java security manager is disabled.|#]
Entering Security Startup Service.|#] Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.|#] Security Service(s) started successfully.|#] Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080|#] Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181|#] Created HTTP listener admin-listener on host/port 0.0.0.0:4848|#] Created virtual server server|#] Created virtual server __asadmin|#] Virtual server server loaded default web module |#] Loading application __admingui done in 1,757 ms|#] Initializing Mojarra |version.string| for context ''|#] Loading application [__admingui] at [/]|#] Context path from ServletContext: differs from path from bundle: /|#]
Redirecting to /common/version.jsf|#] Admin Console: Initializing Session Attributes...|#]

我在 NB 12.6 中遇到了同样的问题,我期待 NB 团队在 NB 13 中解决这个问题。 但不幸的是,问题仍然存在于 13。 this PR 中的相关更改似乎没有进入 NB 13 分发版。

经过一段时间的挖掘,找到了解决方法。

  • 按照本 link
  • 中所述从源构建最新的 NetBeans
  • 从内置 zip 中提取并复制 org-netbeans-modules-payara-tooling.jar 到 NB 12/ 中的 /netbeans/enterprise/modules/ 文件夹中13 安装位置。 (文件夹在内置的 zip 中是准确的)

当然还有一个选择就是使用源码编译的NB