renatsaf opened a new pull request, #9446:
URL: https://github.com/apache/netbeans/pull/9446

   ### What
   
   When running a Jakarta EE **application client** against a registered 
GlassFish server, the run fails immediately because the spawned JVM cannot be 
created:
   
   ```
   
-Djava.endorsed.dirs=/Applications/glassfish7/glassfish/lib/endorsed:/Applications/glassfish7/glassfish/modules/endorsed
 is not supported. ...
   Error: Could not create the Java Virtual Machine.
   Error: A fatal exception has occurred. Program will exit.
   ```
   
   The deploy succeeds; only the client JVM launch fails, every time.
   
   ### Root cause
   
   `Hk2JavaEEPlatformImpl.getToolProperty(TOOL_APP_CLIENT_RUNTIME, 
TOOL_PROP_JVM_OPTS)` always prepended 
`-Djava.endorsed.dirs=<root>/lib/endorsed:<root>/modules/endorsed` to the 
app-client container JVM options. This value ends up in the generated 
`build-impl.xml` via `j2ee.appclient.tool.jvmoptions` and is passed as a 
`<jvmarg>` to the `run-appclient` macro.
   
   The endorsed-standards mechanism was **removed in JDK 9 (JEP 220)**, and 
HotSpot deliberately aborts at startup when `java.endorsed.dirs` is set. 
GlassFish 7 requires JDK 11+ and ships no `endorsed` directories at all, so the 
option is both invalid and pointing at non-existent paths.
   
   ### Fix
   
   Build `-Djava.endorsed.dirs` only from the `lib/endorsed` / 
`modules/endorsed` directories that actually exist, and omit the option 
entirely when neither is present. This lets app clients run on JDK 9+ (modern 
GlassFish), while preserving behavior for legacy servers on JDK 8 that still 
ship those directories.
   
   ### Notes
   
   - The Payara plugin (`payara.jakartaee`) carries the same forked code; left 
out of this PR to keep it focused on the reported GlassFish case, but it should 
get the same treatment in a follow-up.
   
   Fixes #6270


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to