JVM errors
Reproduced on pinned JDK images, fixed and re-checked.
- Unrecognized VM option 'UseConcMarkSweepGC'
`Unrecognized VM option 'UseConcMarkSweepGC'` の直し方(Java 8 から 17 に上げたら JVM が起動しない)
eclipse-temurin@sha256:89dc1a6e09920ea26b2ede6fddfcac1a7508b50159a6d04c918a46132953aab6 · -XX:+UseConcMarkSweepGC (and the CMS/ParNew/Perm companion flags) carried in JAVA_OPTS since Java 8; CMS was obsoleted in JDK 14 and the flag name is gone from JDK 15 on, so the VM refuses to start before main()Java 8 で動いていたアプリを JDK 17 で動かすと、起動した瞬間に終わります。
JVM 9 min read - FileWriter の出力が文字化けする(JDK 18 以降・エラーは出ない)
出力ファイルの文字コードが JDK 18 以降で変わる(charset 未指定の FileWriter・エラーは出ません)
eclipse-temurin@sha256:68868d04fa9cfd5f5c6abec0b5cef86d8de2bf9c62c37c7d3e4f0f80f5cfd7ff · java.io.FileWriter / FileReader with no Charset argument (JEP 400 changed the JDK default charset to UTF-8 in JDK 18) · upgrading from JDK 17 to JDK 18 or later on a host whose locale is not UTF-8 — the same source writes different bytes with no exception and no warning, so the breakage only shows up in whatever reads the fileCSV が別のツールで開けない。ログの日本語が化ける。取り込みバッチが弾く。書き出しているアプリのほうは
JVM 7 min read - Unsupported class file major version 65
Unsupported class file major version 65 の直し方(Gradle が新しい JDK を読めない)
eclipse-temurin:21-jdk · Gradle 7.6.4's bundled ASM cannot read class file major version 65 (JDK 21) while parsing the build script itselfJDK を 21 に上げたあと、Gradle のビルドが次のエラーで落ちることがあります。
JVM 11 min read - does not "opens java.util" to unnamed module
InaccessibleObjectException: module java.base does not "opens java.util" の直し方
eclipse-temurin:17-jdk · setAccessible(true) on a JDK-internal field; strong encapsulation became the default in Java 16 (JEP 396) and --illegal-access was removed in 17 (JEP 403)Java 8 や 11 で動いていたアプリを Java 17 で起動すると、次の例外で落ちることがあります。
JVM 6 min read - package com.fasterxml.jackson.databind does not exist
package com.fasterxml.jackson.databind does not exist の直し方(Spring Boot 4 / Jackson 3 の部分改名)
maven@sha256:2b4496088e7b80ae10a8c9f74e574ea21380325a006ec684532ad6bad5bc7273 · spring-boot-starter-json (Spring Boot 4 ships Jackson 3: databind/core renamed to tools.jackson, while jackson-annotations stays at com.fasterxml 2.20) · upgrading Spring Boot 3.x to 4.0.0 with imports still on com.fasterxml.jackson.databind — annotations imports keep compiling on the same classpath, so only databind/core call sites failSpring Boot を 3 系から 4 に上げた直後のビルドが、次のコンパイルエラーで止まります。
JVM 6 min read - tools.jackson.databind.exc.MismatchedInputException: Cannot map `null` into type `int`
Cannot map `null` into type `int` の直し方(Spring Boot 4 / Jackson 3 で null が例外になる)
maven@sha256:2b4496088e7b80ae10a8c9f74e574ea21380325a006ec684532ad6bad5bc7273 · spring-boot-starter-json (Spring Boot 4 manages tools.jackson.core:jackson-databind:3.0.2, where FAIL_ON_NULL_FOR_PRIMITIVES defaults to enabled) · upgrading Spring Boot 3.x to 4.0.0 with a primitive int field receiving JSON null — same code and JSON succeed on Boot 3.4.1 by silently converting null to 0Spring Boot 3 系で動いていた JSON のデシリアライズが、Boot 4 に上げると次の例外で止まります。
JVM 6 min read - package javax.mail does not exist
package javax.mail does not exist の直し方(jakarta.mail-api は 2.0.0 から中身が jakarta.mail になる)
eclipse-temurin:17-jdk · jakarta.mail:jakarta.mail-api (the Maven coordinate moved from com.sun.mail:javax.mail at 1.6.3, but its classes stayed in javax.mail; the package moves to jakarta.mail only at 2.0.0) · bumping jakarta.mail-api from 1.6.x to 2.x while imports still say javax.mail — the coordinate already said jakarta, so the migration looked done依存を jakarta.mail:jakarta.mail-api に切り替えて版を上げたら、コンパイルが次のエラーで止まることがあります。
JVM 6 min read - java.lang.NoClassDefFoundError: javax/servlet/Filter
NoClassDefFoundError: javax/servlet/Filter の直し方(自分は jakarta に移行したのに、依存が javax を要求する)
eclipse-temurin:17-jdk · spring-web / spring-context (Spring 5's GenericFilterBean implements javax.servlet.Filter; Spring 6's implements jakarta.servlet.Filter — the app itself references neither) · running a jakarta.servlet application that still has a pre-Jakarta library on the classpath — it compiles when nothing in your own source statically references the old library's typesjakarta.servlet へ移行して、自分のコードから javax.* の import を全部消した。コンパイルも通る。
JVM 7 min read - java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
NoClassDefFoundError: javax/xml/bind/JAXBException の直し方(Java 11 以降で JAXB が JDK から消えた)
eclipse-temurin:17-jdk · JEP 320 removed the Java EE modules in Java 11; a class built for Java 8 fails at runtime on 17Java 8 では動いていたアプリを Java 11 や 17 で起動すると、次のエラーで落ちることがあります。
JVM 8 min read - java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer; の直し方
eclipse-temurin:17-jdk · built with -source/-target 8 on JDK 17 (which does not restrict the API), then run on a Java 8 JVM; Buffer methods became covariant in Java 9新しい JDK でビルドしたアプリを古い JVM で動かすと、次のエラーで落ちることがあります。
JVM 5 min read - org/postgresql/shaded/com/ongres/scram/client/ScramClient$ChannelBinding
NoClassDefFoundError: .../scram/client/ScramClient$ChannelBinding の直し方(pgjdbc 42.2.0 だけ SCRAM の実装が入っていない)
postgres@sha256:33f923b05f64ca54ac4401c01126a6b92afe839a0aa0a52bc5aeb5cc958e5f20 · org.postgresql:postgresql 42.2.0 — the release that added SCRAM-SHA-256 support but shipped a jar without the shaded scram/client package (fixed in 42.2.1) · following the common advice to upgrade pgjdbc to 42.2.0 or later after hitting 'The authentication type 10 is not supported', and landing exactly on 42.2.0 — the first error disappears and the SCRAM handshake stops on a missing class insteadPostgreSQL への接続が認証タイプ 10 で落ちたので pgjdbc を「SCRAM 対応版」に上げた——その直後に、
JVM 6 min read - The authentication type 10 is not supported
The authentication type 10 is not supported の直し方(PostgreSQL の scram-sha-256 に古い pgjdbc で接続している)
postgres@sha256:33f923b05f64ca54ac4401c01126a6b92afe839a0aa0a52bc5aeb5cc958e5f20 · org.postgresql:postgresql (pgjdbc) — SCRAM support first appeared in 42.2.0, and the shipped implementation from 42.2.1 · connecting to a PostgreSQL 14 or later server (or any server whose password_encryption is scram-sha-256) with a pgjdbc older than 42.2.0 — the error text points at pg_hba.conf, but the connection stops because the driver cannot read authentication request code 10 (AuthenticationSASL)PostgreSQL のサーバを上げた、あるいは新しいマネージドの PostgreSQL に向けた直後から、Java のアプリが接続で
JVM 8 min read - Failed to create a Robolectric sandbox: Android SDK 36 requires Java 21 (have Java 17)
Android SDK 36 requires Java 21 (have Java 17) の直し方(Robolectric)
eclipse-temurin:17-jdk · Robolectric test requesting Android SDK 36 while the test JVM is Java 17Robolectric のテストが、実行の直前に次のエラーで落ちます。
JVM 8 min read - WorkManager is not initialized properly
`WorkManager is not initialized properly` の直し方(Robolectric のテストで WorkManager を取り出せない)
eclipse-temurin@sha256:89dc1a6e09920ea26b2ede6fddfcac1a7508b50159a6d04c918a46132953aab6 · WorkManager.getInstance() in a Robolectric test where no startup initializer ran; the fix is WorkManagerTestInitHelper.initializeTestWorkManager() from androidx.work:work-testing, which yields a WorkManager driven by TestScheduler (a TestDriver you can advance)Robolectric のテストで WorkManager.getInstance(context) を呼ぶと、テストが例外で落ちます。
JVM 6 min read - A command line option has attempted to allow or enable the Security Manager
A command line option has attempted to allow or enable the Security Manager(JDK 24 以降で JVM が起動しない)の直し方
eclipse-temurin@sha256:68868d04fa9cfd5f5c6abec0b5cef86d8de2bf9c62c37c7d3e4f0f80f5cfd7ff · -Djava.security.manager=allow left in JVM args from the JDK 18 workaround; JEP 486 makes the same flag refuse VM startup from JDK 24Java 21 まで動いていたアプリを JDK 25 で起動すると、アプリのログが 1 行も出ないまま、次のエラーで終わることがあります。
JVM 9 min read - Socket constructor does not support creation of datagram sockets
Socket constructor does not support creation of datagram sockets の直し方(JDK 25 で古い Socket コンストラクタが例外になる)
eclipse-temurin@sha256:68868d04fa9cfd5f5c6abec0b5cef86d8de2bf9c62c37c7d3e4f0f80f5cfd7ff · JDK 25 (Socket(InetAddress,int,boolean) with stream=false now throws IllegalArgumentException; deprecated-for-removal through 24) · legacy code using new Socket(addr, port, false) to make a UDP/datagram socket, run on JDK 25 where the deprecated stream=false path throws IllegalArgumentException (JDK 17/21/24 only warned)長く使ってきた new Socket(address, port, false) の形が、JDK 25 に上げると実行時に次の例外で止まります。
JVM 6 min read - package javax.persistence does not exist
package javax.persistence does not exist の直し方(Spring Boot 3 で javax.persistence が消える)
eclipse-temurin:17-jdk · spring-boot-starter-data-jpa (Spring Boot 3 carries the Jakarta EE 9 namespace, so javax.persistence is absent from the compile classpath; Spring itself did not rename it) · upgrading Spring Boot 2.x to 3.x with entity imports still on javax.persistence — the version bump, not any Spring setting, changes which namespace is on the classpathSpring Boot 2 系で動いていたアプリを 3 系に上げると、エンティティのコンパイルが次のエラーで止まります。
JVM 5 min read - Maven のテスト失敗メッセージだけ文字化けする(surefire-reports のファイルは無事)
テストの失敗メッセージだけ文字化けする(JDK 18 以降は stdout だけ native encoding のまま)
maven@sha256:c3c9d3ac4ce8431a3995c0318b8d390f448e693dd4fabc16e9b68d2e1f3d7b46 · maven-surefire-plugin 3.5.4 on Eclipse Temurin 21.0.11 (JEP 400 applies to file.encoding only; stdout.encoding / stderr.encoding became standard properties in JDK 19) · moving from JDK 17 to JDK 18 or later in a container or CI whose locale is not UTF-8 — the Surefire report file turns UTF-8 while the console keeps writing in the native encoding, so only the failure message on the console is unreadableMaven でテストを走らせると、失敗したテストの説明文だけが読めない文字列になります。アサーションのメッセージに
JVM 9 min read - has been compiled by a more recent version of the Java Runtime (class file version 61.0)
UnsupportedClassVersionError: class file version 61.0 の直し方(Java)
eclipse-temurin:17-jdk · class compiled with a newer JDK executed on an older JVM (release 17 -> Java 8)Java 8 のまま動いていたアプリを、新しい JDK でビルドし直した。あるいは CI の JDK だけが上がった。すると実行時にこれが出ます。
JVM 6 min read - Unrecognized VM option 'UseBiasedLocking'
`Unrecognized VM option 'UseBiasedLocking'` の直し方(JDK 17 から 21 に上げたら JVM が起動しない)
eclipse-temurin@sha256:1eeacc8c295ed4805f6ffead2417b1936aad296b02ea9e56b457230befc9e98d · -XX:+UseBiasedLocking left in JAVA_OPTS; it warns but starts on JDK 17 (LTS), is ignored on 18, and is unrecognized from 19 on — so an LTS-only 17 to 21 migration never sees the version-naming noticeLTS を 17 から 21 に上げたら、アプリが起動しなくなります。
JVM 9 min read - Unrecognized option: -Xnoagent
Unrecognized option: -Xnoagent の直し方(JDK 23 以降で JVM が起動しない)
eclipse-temurin@sha256:83177670e43c17769a5402a60601545318e45e63adf634fb5022340e516cded4 · A legacy -X launcher option (-Xnoagent, -Xfuture, -checksource) left in JVM args; the java launcher rejects it as an unrecognized option once the JDK removes itデバッグ用の起動オプションを昔からそのまま持ち回っているプロジェクトが、JDK 23 で止まります。
JVM 6 min read
条件に一致するエラーはありません。フィルタを緩めてください。