]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15230 Fix JVM startup args for Hazelcast
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Thu, 22 Jul 2021 16:40:59 +0000 (11:40 -0500)
committersonartech <sonartech@sonarsource.com>
Thu, 29 Jul 2021 20:04:50 +0000 (20:04 +0000)
server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java
server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java
server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java
server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java
sonar-application/src/main/assembly/conf/wrapper.conf

index 9896319fe15e9191a179a4888dca2c815a1e98ba..57b367fe9cc0e0beb49e8e77371eb876c403d968 100644 (file)
@@ -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;
   }
 }
index e5a7ea1afed1180530954d6b75cf98a3be5cff10..b4eb48796c61d8500cff126c7d715e1c51a93c7d 100644 (file)
@@ -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;
   }
 }
index db4bb86ef153707c134a271920b8117128cc4b45..20171b98e4cac852eec1589ac025526f5a027d5b 100644 (file)
@@ -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");
   }
 }
index e4f9da4b96f068a1e48b2bd918ed45c92a239781..3134c2f1ef66b70e632b740af09b0895ff70fc30 100644 (file)
@@ -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");
   }
 
 }
index 360026d398d589f73f3c09ec9384e33eb7cc6aa3..c403dbd5b0dbaddefd9f62dfdb5727ad23070dbe 100644 (file)
@@ -14,6 +14,14 @@ wrapper.java.command=java
 #********************************************************************
 wrapper.java.additional.1=-Dsonar.wrapped=true
 wrapper.java.additional.2=-Djava.awt.headless=true
+# extra args needed by hazelcast
+wrapper.java.additional.3=--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
+wrapper.java.additional.4=--add-opens=java.base/java.lang=ALL-UNNAMED
+wrapper.java.additional.5=--add-opens=java.base/java.nio=ALL-UNNAMED
+wrapper.java.additional.6=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
+wrapper.java.additional.7=--add-opens=java.management/sun.management=ALL-UNNAMED
+wrapper.java.additional.8=--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
+
 wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
 wrapper.java.classpath.1=../../lib/sonar-application-@sqversion@.jar
 wrapper.java.classpath.2=../../lib/jsw/wrapper-3.2.3.jar