Backend Development 5 min read

Resolving java.lang.UnsupportedOperationException: PermittedSubclasses Requires by Updating ASM and Related Dependencies

This guide explains how to troubleshoot and fix the UnsupportedOperationException caused by missing or outdated ASM libraries when upgrading the JDK, covering removal of old Maven dependencies, adding the correct ASM version, updating Groovy and related plugins, and disabling the Log4j shutdown hook warning.

FunTester
FunTester
FunTester
Resolving java.lang.UnsupportedOperationException: PermittedSubclasses Requires by Updating ASM and Related Dependencies

While studying Java virtual threads, the author encountered a java.lang.UnsupportedOperationException: PermittedSubclasses requires error after upgrading the JDK, caused by an outdated ASM library that does not support JDK 9+.

Step 1 – Remove old ASM dependencies: Using the Maven‑helper plugin, search for existing ASM artifacts and exclude them with the excludes syntax.

Step 2 – Add a compatible ASM version: Include ASM 9.2 (or any version that supports the current JDK) in the pom.xml :

<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm</artifactId>
    <version>9.2</version>
</dependency>

In many cases this alone resolves the issue because other libraries may already bring the required ASM transitive dependency.

Step 3 – Upgrade related libraries: The JsonPath library used an old ASM version, so updating it to the latest release eliminated further conflicts.

Step 4 – Check Groovy SDK and Maven‑Groovy plugin: An outdated Groovy SDK and Maven‑Groovy compiler plugin also caused failures. The correct configurations are:

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy</artifactId>
    <version>3.0.19</version>
</dependency>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.0.1</version>
        ...
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        ...
    </plugin>
</plugins>

Step 5 – Handle Log4j shutdownHook warning: After the JDK upgrade, Log4j prints a warning about the shutdown hook. Adding shutdownHook="disable" to the Log4j2 configuration silences the warning:

<configuration status="WARN" monitorInterval="30" shutdownHook="disable">
    ...
</configuration>

Following these steps resolves the ASM compatibility error and eliminates the additional Log4j warning, allowing the project to run smoothly on the upgraded JDK.

Javadependency managementMavenJDKlog4jGroovyASM
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.