Search code examples
netbeansglassfishjava-11glassfish-6

Start GlassFish server with JDK11 in NetBeans IDE


I try to run the Glassfish server 6.2.2 on JDK11 which Officially supports JDK 11 on NetBeans 12.5 which itself should have Jakarta EE 9 GlassFish 6 Support. If I start GlassFish I get a message from NetBeans saying

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

If I start GlassFish server via asadmin it works as a charm. So I am guessing it is a NetBeans issue.

Is there a workaround to get this to work or am I missing something?

I have read Problem with Glassfish server on netbeans JDK not 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 but they are all about older GlassFish versions prior to version 6.


EDIT

By the way: if I try to start GlassFish 6.2.2 with JDK8 I get an error message

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

So I have no possibility to start the server at all.


Solution

  • While the 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" clarifies the extent of that support:

    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.

    So NetBeans 12.5 does not support the use of Glassfish 6.2.x. Bear in mind that NetBeans 12.5 was released on September 13, nearly three weeks prior to the release of Glassfish 6.2, so the lack of support is hardly unreasonable.

    For more details on why GlassFish 6.2.x won't work with NetBeans 12.5, see these comments from NetBeans issue 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.

    It looks like support for GlassFish 6.2.x will be included in NetBeans 12.6 which is currently scheduled for release later this month, sometime between November 15th and November 30th.


    Updated 12/8/21: The OP has confirmed that this issue is resolved with NetBeans 12.6, which was released on 11/29/21.