Search code examples
jakarta-eeglassfish

GlassFish 6 and JDK 11


I am approacing Jakarta EE 9 and I seem to understand that GF 6 run only on JDK 8 .On the other side Jakarta EE 9 is compatible with JDK 8 , then this permit to develop and run EE 9 application on GF 6 , ok , but my doubts :

  1. it's make a sense to developing on latest/hot Jakarta EE 9 technology if the first EE implementation can run only on JDK 8 ? why ?

Solution

  • It's true that Jakarta EE 9 is essentially exactly the same as Jakarta EE 8, but then with the javax.* package/prefix throughout the source code renamed to jakarta.*. The minimum required Java SE version therefore also remains 1.8. Imporantingly because the TCK tests still require a minimum of Java SE 1.8.

    However, specifically for GlassFish 6.0.0 the story is a bit different behind the scenes. Whilst it also still minimally requires Java SE 1.8, it is all by itself in turn not compatible with Java SE 11 or newer. I.e. you can't even execute GlassFish core engine using Java SE 11. It would immediately die with the following error message:

    JVM failed to start: com.sun.enterprise.admin.launcher.GFLauncherException: The server exited prematurely with exit code 1.

    This specific problem is really different from the Java SE compatibility of the Jakarta EE API itself, also from other Jakarta EE servers, which can themselves just be compatible with a newer Java SE version.

    For example, WildFly 22+, is perfectly compatible with Java SE 11 (even all the way up to the currently available 15), so you can safely run Jakarta EE 9 applications on WildFly with a Java SE version up to 15.

    There were plans to make GlassFish 6.0.0 Java SE 11 compatible right before the release of Jakarta EE 9 but unfortunately that did't made it due to lack of time of open source code committers. Currently there's a GlassFish 6.1.0 work in progress which should make it finally compatible with Java SE 11 (and hopefully also newer).