4

We are migrating web apps that use java 1.7 here at the company. We then chose to use the latest stable version of JDK 17 and Payara server (we already use Glassfish), however when linking the server on NetBeans the Java 17 LTS platform does not appear to be selected in the server properties. Has anyone ever experienced this?

skomisa
  • 16,436
  • 7
  • 61
  • 102
Elvis Fabiane
  • 43
  • 1
  • 4

2 Answers2

4

I have the same issue with NB 12.6 and I was expecting NB team to fix this with NB 13. But unfortunately, the issue still exists on 13. Seems related changes in this PR didn't go NB 13 distribution.

After digging for a while found a workaround.

  • Build latest NetBeans from source as described in this link
  • Extract and copy org-netbeans-modules-payara-tooling.jar from built zip into /netbeans/enterprise/modules/ folder in NB 12/13 installation location. (The folder is exact in the built zip)

Of course, the other option is to use NB compiled from source.

comul
  • 156
  • 6
  • 1
    Unfortunately it looks like you are correct: either the planned fix didn't go, or it went but didn't work. Issue #3758 was raised for this today on GitHub: [JDK 17 support to Payara Platform tools in Apache NetBeans](https://github.com/apache/netbeans/issues/3758). – skomisa Mar 11 '22 at 01:24
2

I faced the same problem as you when adding the Payara server: JDK 17 was not offered as a platform for Payara even though NetBeans was running fine on JDK 17. The Java SE Platform window even explicitly gave me the error Payara server could not be started with JDK 17 (Default). Please select another Java SE Platform. when starting Payara.

I don't have a true solution, but a simple workaround is to add JDK 11 as a second Java platform in NetBeans (Tools > Java Platforms > Add Platform...), and then select JDK 11 instead. Payara runs fine under JDK 11:

Select Java platform

After that, just go to http://localhost:4848/ (or whatever alternative port you chose) once the server has been started to verify that Payara is working:

Payara console

Notes :

  1. You can only use LTS releases for Payara, which currently means that your only JDK options are 8, 11 and 17. See Why Payara Platform Only Supports LTS Versions of JDK for more information on that.
  2. I selected the most recent version of Payara that was offered: 5.2021.9.
  3. I don't know why Payara can't be started using JDK 17 even when NetBeans itself is running on JDK 17, but I suspect that it may be relevant that NetBeans 12.6 only offers "experimental support" for JDK 17. You can pursue this by creating a NetBeans Bug Report, though you will have to register first.
  4. FYI, I have pasted below the content of the Payara server log in case you still have problems:

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...|#]

skomisa
  • 16,436
  • 7
  • 61
  • 102
  • Thanks for the excellent response. Apparently there's not much to do so, we'll have to wait for compatibility. My question now is, if I develop using JDK 11 and send it to clients who will be using Payara that supports JDK 17, it will work, right? In this case in the future we will update the JDK and we will not update the clients' servers. – Elvis Fabiane Dec 10 '21 at 02:42
  • @user3570528 [1] Yes, you can send your JDK 11 apps to your clients who are running Payara with JDK 17, because Java is (mostly) forward compatible. [2] I forgot to mention in the answer that there is a simple workaround for Payara not running under JDK 17 in NetBeans: run Payara under JDK 17 _outside of NetBeans_ instead (although I haven't tried that yet). [3] That approach makes deployment and server administration a bit more tedious, but shouldn't be a deal breaker if you really prefer to be running Payara on JDK 17, and also developing your apps on JDK 17. – skomisa Dec 10 '21 at 07:54
  • @user3570528 One other point: you could conceivably get in trouble if you were using JDK classes in your Java 11 applications that did not exist in JDK 17. Then your apps would work fine on a Payara server running on JRE 11, but would crash on a Payara server running on JRE 17. Unlikely, but certainly possible, and the solution for that is to avoid using deprecated APIs in your apps. – skomisa Dec 10 '21 at 08:04
  • Hello good Morning. It works perfectly, we've already done the test here, but as you said it would be a little tricky since we have 8 developers. So let's follow this idea, let's compile everything on 11 and for customers we will install the latest version of Payara that supports 17. When this IDE issue with Payara is fixed, we will update the version, to get the new features implemented after 11, mainly in terms of performance. I think that's it for now. Thank you again for your help. – Elvis Fabiane Dec 10 '21 at 12:42
  • Netbeans 13 has been released and the error continues. disheartening. – Elvis Fabiane Mar 11 '22 at 00:09
  • @ElvisFabiane Yes, it looks like someone actually bug reported this as a NetBeans 13 issue earlier today on GitHub: [JDK 17 support to Payara Platform tools in Apache NetBeans IDE #3758](https://github.com/apache/netbeans/issues/3758). I don't know whether the proposed fix [JDK 17 support to Payara Platform tools in Apache NetBeans IDE #3508](https://github.com/apache/netbeans/pull/3508) didn't make it into NB13, or it made it but doesn't work! Either way, ["Payara Platform Community 5.2021.9 can be used on JDK 17"](https://blog.payara.fish/jdk17-support-in-payara-community). – skomisa Mar 11 '22 at 01:08
  • @ElvisFabiane Since the problem lies with NetBeans (rather than Payara or JDK 17), I don't see an obvious solution for you. Some ugly possibilities are: [1] Trying another IDE such Eclipse or Intellij IDEA to see if the issue does not exist there. [2] Running Payara with JDK 17 outside of NetBeans, so you could still develop JDK 17 apps on NB 13, but you would have to deploy them to Payara manually. [3] Try using an alternative server within NetBeans such as WildFly. None of those approaches seem very appealing though. – skomisa Mar 11 '22 at 01:16
  • @ElvisFabiane From [Apache NetBeans 13 Features](https://netbeans.apache.org/download/nb13/), it looks like issue #3508 was not implemented, so I guess we will have to wait for it to be included in NetBeans 14. Based on their [Release Schedule](https://cwiki.apache.org/confluence/display/NETBEANS/Release+Schedule), that would be in the second half of May. – skomisa Mar 11 '22 at 01:36
  • Unfortunately this solution to deploy manually has no way, impossible to work without debug, total lack of respect on the part of netbeans with the developers. – Elvis Fabiane Mar 13 '22 at 02:41
  • @ElvisFabiane Understood. I guess you'll have to wait for NetBeans 14 to use Payara with JDK 17. If using a server other than Payara/Glassfish is a possible option, I have [added WildFly 26.0.1](https://www.wildfly.org/news/2021/12/16/WildFly26-Final-Released/) on NetBeans 13 using JDK 17.0.2 and it works fine. (Not sure, but I don't think Tomcat EE supports Java 17 yet.) – skomisa Mar 14 '22 at 03:53
  • My colleague and I compiled the netbeans version from master and everything works fine. It will probably be fixed in netbeans 14. Let's wait. Should I close the topic? – Elvis Fabiane Mar 15 '22 at 12:04
  • [1] OK, but I'm not sure what you mean by _"close the topic"_? Your question is definitely useful to the community so don't remove it, or am I misunderstanding? [2] If you did what was suggested in [the answer from comul](https://stackoverflow.com/a/71385301/2985643) then consider accepting that as the solution to your problem. And if you did something else, then consider posting and accepting your own answer. Having an accepted answer is always much better than having a resolution buried in the comments. – skomisa Mar 15 '22 at 14:57
  • OK. I marked the answer as correct. I really appreciate everyone's help. – Elvis Fabiane Mar 18 '22 at 14:08