aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-main/src
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2021-07-22 11:40:59 -0500
committersonartech <sonartech@sonarsource.com>2021-07-29 20:04:50 +0000
commitc9676adac645c042119fa267bc98179f53f80169 (patch)
tree44982e64dc179b44f649938e65902821119539c3 /server/sonar-main/src
parent78a0a38cd36db3d2c38ffd7ccc494bcd9d366ad9 (diff)
downloadsonarqube-c9676adac645c042119fa267bc98179f53f80169.tar.gz
sonarqube-c9676adac645c042119fa267bc98179f53f80169.zip
SONAR-15230 Fix JVM startup args for Hazelcast
Diffstat (limited to 'server/sonar-main/src')
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java8
-rw-r--r--server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java8
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java8
-rw-r--r--server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java7
4 files changed, 29 insertions, 2 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java
index 9896319fe15..57b367fe9cc 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java
@@ -37,6 +37,14 @@ public class CeJvmOptions extends JvmOptions<CeJvmOptions> {
res.put("-XX:-OmitStackTraceInFastThrow", "");
// avoid illegal reflective access operations done by MyBatis
res.put("--add-opens=java.base/java.util=ALL-UNNAMED", "");
+
+ // avoid illegal reflective access operations done by Hazelcast
+ res.put("--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED", "");
+ res.put("--add-opens=java.base/java.lang=ALL-UNNAMED", "");
+ res.put("--add-opens=java.base/java.nio=ALL-UNNAMED", "");
+ res.put("--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", "");
+ res.put("--add-opens=java.management/sun.management=ALL-UNNAMED", "");
+ res.put("--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED", "");
return res;
}
}
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java
index e5a7ea1afed..b4eb48796c6 100644
--- a/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java
+++ b/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java
@@ -42,6 +42,14 @@ public class WebJvmOptions extends JvmOptions<WebJvmOptions> {
res.put("--add-opens=java.base/java.lang=ALL-UNNAMED", "");
res.put("--add-opens=java.base/java.io=ALL-UNNAMED", "");
res.put("--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED", "");
+
+ // avoid illegal reflective access operations done by Hazelcast
+ res.put("--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED", "");
+ res.put("--add-opens=java.base/java.nio=ALL-UNNAMED", "");
+ res.put("--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", "");
+ res.put("--add-opens=java.management/sun.management=ALL-UNNAMED", "");
+ res.put("--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED", "");
+
return res;
}
}
diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java
index db4bb86ef15..20171b98e4c 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java
@@ -45,6 +45,12 @@ public class CeJvmOptionsTest {
underTest = new CeJvmOptions(tmpDir);
assertThat(underTest.getAll()).containsExactly(
"-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow",
- "--add-opens=java.base/java.util=ALL-UNNAMED");
+ "--add-opens=java.base/java.util=ALL-UNNAMED",
+ "--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
+ "--add-opens=java.base/java.lang=ALL-UNNAMED",
+ "--add-opens=java.base/java.nio=ALL-UNNAMED",
+ "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
+ "--add-opens=java.management/sun.management=ALL-UNNAMED",
+ "--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED");
}
}
diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
index e4f9da4b96f..3134c2f1ef6 100644
--- a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
+++ b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
@@ -49,7 +49,12 @@ public class WebJvmOptionsTest {
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
- "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED");
+ "--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED",
+ "--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
+ "--add-opens=java.base/java.nio=ALL-UNNAMED",
+ "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
+ "--add-opens=java.management/sun.management=ALL-UNNAMED",
+ "--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED");
}
}