From f692d2bfbf9912cee5c35f49be33475e4504e9ba Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 26 Feb 2024 14:34:28 -0700 Subject: [PATCH 1/8] Update to jdk 17 --- gradle/any/java-internal.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/any/java-internal.gradle b/gradle/any/java-internal.gradle index d371782e2a..1c8417783f 100644 --- a/gradle/any/java-internal.gradle +++ b/gradle/any/java-internal.gradle @@ -2,8 +2,8 @@ apply plugin: 'java' apply from: "$rootDir/gradle/any/spotless.gradle" java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } // Will apply to "compileJava", "compileTestJava", "compileSourceSetJava", etc. From 743cfb822a2f5de1896140bb31121626e56b3940 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 26 Feb 2024 15:00:26 -0700 Subject: [PATCH 2/8] Update github workflows to use jdk 17 --- .github/workflows/deps.yml | 4 ++-- .github/workflows/docs.yml | 4 ++-- .github/workflows/style.yml | 4 ++-- .github/workflows/tds.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index 7936157b3f..083993ef2b 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -6,10 +6,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Build with Gradle (refresh dependencies) run: ./gradlew clean classes testClasses assemble --refresh-dependencies diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8c8dd9d9dc..f123380d2f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,11 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Java 11 + - name: Setup Java 17 uses: actions/setup-java@v2 with: distribution: 'zulu' - java-version: '11' + java-version: '17' - name: Cache Gradle packages uses: actions/cache@v1 with: diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index e0596a296b..5a6a97bd3d 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -6,11 +6,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Cache Gradle packages uses: actions/cache@v1 with: diff --git a/.github/workflows/tds.yml b/.github/workflows/tds.yml index 174990fa5a..fea325dded 100644 --- a/.github/workflows/tds.yml +++ b/.github/workflows/tds.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java-version: [ 11 ] + java-version: [ 17 ] java-vendor: [ 'zulu', 'temurin' ] # test against tomcat 8.5.x and tomcat 9.x servletcontainer: [ 'tomcat85', 'tomcat9' ] From c166171d761d151d94210df55beee01419ca50c0 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 8 Jul 2024 14:33:36 -0600 Subject: [PATCH 3/8] Remove jvmArg illegal-access, as this is removed in jdk 17 --- tds/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tds/build.gradle b/tds/build.gradle index 75f25ce947..1675fc922d 100644 --- a/tds/build.gradle +++ b/tds/build.gradle @@ -257,7 +257,7 @@ import java.nio.file.Paths gretty { httpPort = 8081 contextPath = '/thredds' - jvmArgs = ['--illegal-access=permit', '--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED'] + jvmArgs = ['--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED'] } def testInfomation = [[name: 'freshInstallTest', From b9f2a2a4cfa517ece6798af52fbc1b1df5c996c0 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 8 Jul 2024 14:55:49 -0600 Subject: [PATCH 4/8] Add jvmArgs needed by Chronicle with jdk 17 strong encapsulation --- gradle/any/properties.gradle | 14 ++++++++++++++ tdcommon/build.gradle | 4 ++++ tds/build.gradle | 6 +++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gradle/any/properties.gradle b/gradle/any/properties.gradle index a132de0eea..d3d56b1558 100644 --- a/gradle/any/properties.gradle +++ b/gradle/any/properties.gradle @@ -52,3 +52,17 @@ ext { getPropertyOrFailBuild = this.&getPropertyOrFailBuild addFilteredSysProps = this.&addFilteredSysProps } + +ext { + jvmArguments = [ + '--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED', + '--add-exports', 'java.base/sun.nio.ch=ALL-UNNAMED', + '--add-exports', 'jdk.unsupported/sun.misc=ALL-UNNAMED', + '--add-exports', 'jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', + '--add-opens', 'jdk.compiler/com.sun.tools.javac=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED', + '--add-opens', 'java.base/java.io=ALL-UNNAMED', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + ] +} diff --git a/tdcommon/build.gradle b/tdcommon/build.gradle index d73d713a8c..c8ea803b74 100644 --- a/tdcommon/build.gradle +++ b/tdcommon/build.gradle @@ -48,3 +48,7 @@ spotless { tasks.named('sourceJar').configure { dependsOn('generateProto') } + +test { + jvmArgs = jvmArguments +} diff --git a/tds/build.gradle b/tds/build.gradle index 1675fc922d..68c111ccc9 100644 --- a/tds/build.gradle +++ b/tds/build.gradle @@ -254,10 +254,14 @@ import org.akhikhl.gretty.AppAfterIntegrationTestTask import java.nio.file.Paths +test { + jvmArgs = jvmArguments +} + gretty { httpPort = 8081 contextPath = '/thredds' - jvmArgs = ['--add-exports', 'java.base/jdk.internal.ref=ALL-UNNAMED'] + jvmArgs = jvmArguments } def testInfomation = [[name: 'freshInstallTest', From 58cb2e0fa9f9bf5c1aa5d6de5a3c90c5f2b53697 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Fri, 12 Jul 2024 16:30:49 -0600 Subject: [PATCH 5/8] Remove zulu 17 from github actions for now --- .github/workflows/tds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tds.yml b/.github/workflows/tds.yml index fea325dded..ad73beea37 100644 --- a/.github/workflows/tds.yml +++ b/.github/workflows/tds.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: java-version: [ 17 ] - java-vendor: [ 'zulu', 'temurin' ] + java-vendor: [ 'temurin' ] # test against tomcat 8.5.x and tomcat 9.x servletcontainer: [ 'tomcat85', 'tomcat9' ] steps: From f3522b4ae6e9c579d2c23ee0b915837073a30412 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Thu, 18 Jul 2024 13:45:03 -0600 Subject: [PATCH 6/8] Update JDK version in docs --- .../pages/tds_tutorial/getting_started/InstallJavaTomcat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md b/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md index 2396f1ff35..7f9da40dea 100644 --- a/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md +++ b/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md @@ -14,7 +14,7 @@ Users of OS-provided packages via package management systems for Java and/or Tom ## System Requirements -* OpenJDK Java 11 +* OpenJDK Java 17 * Apache Tomcat 8.x or 9.x While there are different distributors of Java and servlet containers, Unidata develops, uses and tests the THREDDS Data Server using _OpenJDK Java_ and the _Apache Tomcat_ servlet container. From f3cf8610478da69c7bdd2958621f0bf9bec671e5 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Thu, 18 Jul 2024 13:45:24 -0600 Subject: [PATCH 7/8] Remove specific jdk version number from examples --- .../getting_started/InstallJavaTomcat.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md b/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md index 7f9da40dea..1135d27998 100644 --- a/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md +++ b/docs/userguide/src/site/pages/tds_tutorial/getting_started/InstallJavaTomcat.md @@ -29,7 +29,7 @@ The installation is being performed as the `root` user. For installation of the JDK on Windows or Mac OS, see the [JDK Installation Guide](https://adoptium.net/installation.html){:target='_blank'}. " %} -1. [Download](https://adoptium.net/){:target="_blank"} current OpenJDK 11 (LTS) JDK version from the AdoptOpenJDK site. +1. [Download](https://adoptium.net/){:target="_blank"} the required OpenJDK version from the AdoptOpenJDK site. 2. Install the JDK. @@ -39,17 +39,17 @@ For installation of the JDK on Windows or Mac OS, see the [JDK Installation Guid # pwd /usr/local - # cp /tmp/jdk-8u192-linux-x64.tar.gz . + # cp /tmp/jdk-xx.tar.gz . # ls -l total 187268 - -rw-r--r-- 1 root root 191757099 Oct 24 13:19 jdk-11.0.11.tar.gz + -rw-r--r-- 1 root root 191757099 Oct 24 13:19 jdk-xx.tar.gz ~~~ Unpack the archive file: ~~~bash - # tar xvfz jdk-11.0.11.tar.gz + # tar xvfz jdk-xx.tar.gz ~~~ This will extract the JDK in the installation directory: @@ -57,17 +57,17 @@ For installation of the JDK on Windows or Mac OS, see the [JDK Installation Guid ~~~bash # ls -l total 187272 - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 - -rw-r--r-- 1 root root 191757099 Oct 24 13:19 jdk-11.0.11.tar.gz + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx + -rw-r--r-- 1 root root 191757099 Oct 24 13:19 jdk-xx.tar.gz ~~~ Remove the remaining binary `tar.gz` file when the installation is complete. ~~~bash - # rm jdk-11.0.11.tar.gz + # rm jdk-xx.tar.gz # ls -l total 187279 - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx ~~~ {% include important.html content=" @@ -101,7 +101,7 @@ For installation of Tomcat on Windows, see the [Tomcat Setup Guide](http://tomca # ls -l total 196676 -rw-r--r-- 1 root root 9625824 Oct 24 13:27 apache-tomcat-8.5.34.tar.gz - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx ~~~ Unpack the archive file: @@ -117,7 +117,7 @@ For installation of Tomcat on Windows, see the [Tomcat Setup Guide](http://tomca total 196680 drwxr-xr-x 9 root root 4096 Oct 24 13:29 apache-tomcat-8.5.34 -rw-r--r-- 1 root root 9625824 Oct 24 13:27 apache-tomcat-8.5.34.tar.gz - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx ~~~ Remove the remaining binary `tar.gz` file when the installation is complete. @@ -127,7 +127,7 @@ For installation of Tomcat on Windows, see the [Tomcat Setup Guide](http://tomca # ls -l total 187282 drwxr-xr-x 9 root root 4096 Oct 24 13:29 apache-tomcat-8.5.34 - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx ~~~ ## Create Symbolic Links @@ -149,13 +149,13 @@ Windows users can consult the [Microsoft Documentation](https://docs.microsoft.c /usr/local # ln -s apache-tomcat-8.5.34 tomcat - # ln -s jdk-11.0.11 jdk + # ln -s jdk-xx jdk # ls -l total 196684 drwxr-xr-x 9 root root 4096 Oct 24 13:29 tomcat -> apache-tomcat-8.5.34 drwxr-xr-x 9 root root 4096 Oct 24 13:29 apache-tomcat-8.5.34 - lrwxrwxrwx 1 root root 12 Oct 24 13:59 jdk -> jdk-11.0.11 - drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-11.0.11 + lrwxrwxrwx 1 root root 12 Oct 24 13:59 jdk -> jdk-xx + drwxr-xr-x 7 root root 4096 Oct 6 07:58 jdk-xx ~~~ ## Next Step From b40f042fa3471de6c594289aef5c1f89f328f3e4 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Fri, 19 Jul 2024 15:08:00 -0600 Subject: [PATCH 8/8] Add Chronicle cache JVM args to documentation --- docs/userguide/src/site/pages/tds_tutorial/faq/faq.md | 11 +++++++++++ .../tds_tutorial/getting_started/RunningTomcat.md | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/userguide/src/site/pages/tds_tutorial/faq/faq.md b/docs/userguide/src/site/pages/tds_tutorial/faq/faq.md index 5086758947..7fc9ca75b7 100644 --- a/docs/userguide/src/site/pages/tds_tutorial/faq/faq.md +++ b/docs/userguide/src/site/pages/tds_tutorial/faq/faq.md @@ -301,6 +301,17 @@ com.google.common.util.concurrent.UncheckedExecutionException: java.lang.Illegal then you may need to adjust your [FMRC cache settings](https://docs.unidata.ucar.edu/tds/current/userguide/tds_config_ref.html#featurecollection-cache). +### Failed to start up with JDK 17 + +If you are upgrading to JDK 17 and your serverStartup.log contains an error like +~~~ +ERROR org.springframework.web.context.ContextLoader: Context initialization failed +java.lang.ExceptionInInitializerError: null + at net.openhft.chronicle.core.internal.ClassUtil.getSetAccessible0Method(ClassUtil.java:32) ~[chronicle-core-2.25ea15.jar:?] + ... +~~~ +You may be missing the JVM arguments need by the chronicle library. Please see `$CHRONICLE_CACHE` in [`${tomcat_home}/bin/setenv.sh`](running_tomcat.html#setting-java_home-java_opts-catalina_home-catalina_base-and-content_root) + ## Caching ### We use compressed netCDF files, and the very first access to them are quite slow, although subsequent accesses are much faster, then become slow again after a while. diff --git a/docs/userguide/src/site/pages/tds_tutorial/getting_started/RunningTomcat.md b/docs/userguide/src/site/pages/tds_tutorial/getting_started/RunningTomcat.md index ef20909d1e..640d781179 100644 --- a/docs/userguide/src/site/pages/tds_tutorial/getting_started/RunningTomcat.md +++ b/docs/userguide/src/site/pages/tds_tutorial/getting_started/RunningTomcat.md @@ -128,11 +128,12 @@ Download an {% include link_file.html file="tds_tutorial/getting_started/setenv. NORMAL="-d64 -Xmx4096m -Xms512m -server" HEAP_DUMP="-XX:+HeapDumpOnOutOfMemoryError" HEADLESS="-Djava.awt.headless=true" + CHRONICLE_CACHE="--add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED" # # Standard setup. # - JAVA_OPTS="$CONTENT_ROOT $NORMAL $HEAP_DUMP $HEADLESS $JAVA_PREFS_ROOTS" + JAVA_OPTS="$CONTENT_ROOT $NORMAL $HEAP_DUMP $HEADLESS $JAVA_PREFS_ROOTS $CHRONICLE_CACHE" export JAVA_OPTS ~~~ @@ -153,6 +154,7 @@ Download an {% include link_file.html file="tds_tutorial/getting_started/setenv. * `-Djava.awt.headless=true` is needed to prevent graphics rendering code from assuming a graphics console exists. Without this, WMS code will crash the server in some circumstances. * `-Djava.util.prefs.systemRoot=$CONTENT_ROOT/thredds/javaUtilPrefs -Djava.util.prefs.userRoot=$CONTENT_ROOT/thredds/javaUtilPrefs` allows the java.util.prefs of the TDS WMS to write system preferences to a location that is writable by the Tomcat user. + * The parameters in `$CHRONICLE_CACHE` are required by the [chronicle libraries](https://chronicle.software/chronicle-support-java-17/) to run with JDK 17 {%include note.html content=" For more information about the possible options/arguments available for `$JAVA_OPTS`, please consult the [Oracle Documentation](https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#BABDJJFI){:target='_blank'}.