Java agent throws UnsupportedClassVersionError when Instrumentation#retransformClasses is called.

I need to dump who invokes a setCancelled(boolean cancelled) method in a running jar (Spigot 1.8). I decided to do this via dumping the caller using StackWalker by using a javaagent to add a method call which dumps the caller, the item field which is of type org.bukkit.inventory.ItemStack, & the cancelled argument. The only issue currently, is that when i call retransformClasses the whole thing comes burning down.

Target class: org.bukkit.event.player.PlayerInteractEvent

The agent is compiled under Java 17.0.12
the JVM is 17.0.12
The spigot jar is java 8 (i think)

Ran via the -javaagent command line option
Was this page helpful?