Java – Payara Server 5.192: cannot start with JDK11 on IntelliJ

Payara Server 5.192: cannot start with JDK11 on IntelliJ… here is a solution to the problem.

Payara Server 5.192: cannot start with JDK11 on IntelliJ

I can start Payara v5.192 with JDK11 from the command line, but after trying to start it via IntelliJ it breaks with the following error:

-Xbootclasspath/p is no longer a supported option

And I can’t even launch it through the terminal anymore.

This is part of the IntelliJ logs:

C:\Program Files\Java\jdk-11.0.3\bin\java.exe
-cp
D:/Program Files/payara-5.192/glassfish/modules/glassfish.jar
-XX:+UnlockDiagnosticVMOptions
-XX:NewRatio=2
-Xbootclasspath/p:D:\Program Files\payara-5.192\glassfish/lib/grizzly-npn-bootstrap-1.8.1.jar
[...]

My project is configured to use JDK 11.0.3, what could be the issue?

EDIT: I’m using IntelliJ 2019.1.3 on Windows and I’m not experiencing this issue on Debian

EDIT2: Apparently the configuration changed after launching the domain with IntelliJ, here is the domain .xml before and after: -> https://pastebin.com/F3r3nWet

Solution

I’ve encountered the same error myself on macOS High Sierra. For me, the reason is a conflict between the version of the JDK (1.8) I run asadmin by default and the version that IntelliJ puts into domain.xml (11.0.1).

In addition to updating your domain.xml, one workaround is to fix the JDK used by asadmin, for example by setting the AS_JAVA parameter in glassfish/config/asenv.conf.

EDIT: Since IntelliJ comes with a bundled JDK 1.8, I believe asadmin is running with it, not JDK 11 that causes conflicting configurations — asadmin seems to have checked the JDK it runs on and made some (in this case) wrong assumptions.

Edit 2: The JB SDK is not relevant. The asadmin command runs using the JDK in the path, not the JDK configured to the domain. If your default (in path) JDK is <9 and the JDK configured for your domain >=9, you will receive this error because the parameters for npn’s bootclasspath are parameterized on the version of the JDK that is running.

Edit 3: Report and confirm as an error: https://github.com/payara/Payara/issues/4025

Edit 4: The fix has been merged into the repository and is expected to release 5.193 next month.

Related Problems and Solutions