From a2a89d3f961dae80b332049711d2270c582ad771 Mon Sep 17 00:00:00 2001 From: "jakub.zadroga" Date: Tue, 18 Jun 2024 15:32:53 +0100 Subject: [PATCH 1/2] Add support for multiple add-opens CLI args to CordaCaplet --- node/capsule/src/main/java/CordaCaplet.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/capsule/src/main/java/CordaCaplet.java b/node/capsule/src/main/java/CordaCaplet.java index 99dd004ec9..240d9c6c37 100644 --- a/node/capsule/src/main/java/CordaCaplet.java +++ b/node/capsule/src/main/java/CordaCaplet.java @@ -34,6 +34,8 @@ public class CordaCaplet extends Capsule { private Config nodeConfig = null; private String baseDir = null; + private final List cmdLineAddOpens = new ArrayList<>(); + protected CordaCaplet(Capsule pred) { super(pred); } @@ -101,6 +103,7 @@ public class CordaCaplet extends Capsule { protected ProcessBuilder prelaunch(List jvmArgs, List args) { checkJavaVersion(); nodeConfig = parseConfigFile(args); + cmdLineAddOpens.addAll(jvmArgs.stream().filter(arg -> arg.startsWith("--add-opens")).collect(toList())); return super.prelaunch(jvmArgs, args); } @@ -119,7 +122,9 @@ public class CordaCaplet extends Capsule { @Override protected int launch(ProcessBuilder pb) throws IOException, InterruptedException { List args = pb.command(); - args.addAll(1, getNodeJvmArgs()); + List nodeJvmArgs = getNodeJvmArgs(); + nodeJvmArgs.addAll(cmdLineAddOpens); + args.addAll(1, nodeJvmArgs); pb.command(args); return super.launch(pb); } @@ -168,6 +173,7 @@ public class CordaCaplet extends Capsule { boolean defaultOutOfMemoryErrorHandling = true; try { List configJvmArgs = nodeConfig.getStringList("custom.jvmArgs"); + cmdLineAddOpens.addAll(configJvmArgs.stream().filter(arg -> arg.startsWith("--add-opens")).collect(toList())); jvmArgs.clear(); jvmArgs.addAll(configJvmArgs); log(LOG_VERBOSE, "Configured JVM args = " + jvmArgs); From bb91f46fee7c09eed1eb33289d8e49370780b6b9 Mon Sep 17 00:00:00 2001 From: "jakub.zadroga" Date: Tue, 18 Jun 2024 16:42:45 +0100 Subject: [PATCH 2/2] Add add-opens to fix ENT-11847 --- node/capsule/src/main/resources/node-jvm-args.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/node/capsule/src/main/resources/node-jvm-args.txt b/node/capsule/src/main/resources/node-jvm-args.txt index eb3b13817f..965a2ea188 100644 --- a/node/capsule/src/main/resources/node-jvm-args.txt +++ b/node/capsule/src/main/resources/node-jvm-args.txt @@ -12,6 +12,7 @@ --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED +--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED