Fixes #3333 - Jetty 10 standalone cannot start on the module-path.

Added --add-modules=ALL-MODULE-PATH by default because now Jetty has
proper JPMS modules and when starting in standalone mode only the
org.eclipse.jetty.xml module will be in the module graph - while
before automatic modules where added to the module graph implicitly.

Added --add-reads=ALL-UNNAMED to the websocket module to allow the
websocket implementation to access method handles of application
classes (the websocket endpoints) that live in the web application
classloader (which forms an unnamed module).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2019-02-07 17:48:17 +01:00
parent e2506d4811
commit 6f7e1e3c48
2 changed files with 16 additions and 11 deletions

View File

@ -585,6 +585,7 @@ public class StartArgs
} }
} }
} }
jmodAdds.add("ALL-MODULE-PATH");
StartLog.debug("Expanded JPMS directives:%nadd-modules: %s%npatch-modules: %s%nadd-opens: %s%nadd-exports: %s%nadd-reads: %s", StartLog.debug("Expanded JPMS directives:%nadd-modules: %s%npatch-modules: %s%nadd-opens: %s%nadd-exports: %s%nadd-reads: %s",
jmodAdds, jmodPatch, jmodOpens, jmodExports, jmodReads); jmodAdds, jmodPatch, jmodOpens, jmodExports, jmodReads);
} }
@ -1110,7 +1111,8 @@ public class StartArgs
if ("--jpms".equals(arg)) if ("--jpms".equals(arg))
{ {
jpms = true; jpms = true;
// Need to fork because we cannot use JDK 9 Module APIs. // Forking is simpler; otherwise we need to add the
// JPMS directives such as "--add-modules" via API.
exec = true; exec = true;
return; return;
} }

View File

@ -1,15 +1,18 @@
DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description] [description]
Enable websockets for deployed web applications Enable websockets for deployed web applications
[depend] [depend]
# websocket client needs jetty-client # websocket client needs jetty-client
client client
# javax.websocket needs annotations # javax.websocket needs annotations
annotations annotations
[lib]
lib/websocket/*.jar
[lib]
lib/websocket/*.jar
[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.javax.common=ALL-UNNAMED