I managed to setup HotswapAgent and got it running last week.
However, after upgrading to IntelliJ IDEA 2024.3, from 2024.2.4, I would receive the following error when debugging:
C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\catalina.bat run
Using CATALINA_BASE: "C:\Users\tyjuji\AppData\Local\JetBrains\IntelliJIdea2024.3\tomcat\30152101-a7db-4ec9-ab1e-1ffe10744bee"
Using CATALINA_HOME: "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96"
Using CATALINA_TMPDIR: "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\temp"
Using JRE_HOME: "C:\Repos\jbrdcevm11"
Using CLASSPATH: "C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\bootstrap.jar;C:\Users\tyjuji\IdeaProjects\apache-tomcat-9.0.96\bin\tomcat-juli.jar"
Using CATALINA_OPTS: ""
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2024-11-19 11:07:57,711] Artifact GUSCUST00005: Waiting for server connection to start artifact deployment…
Connected to the target VM, address: '127.0.0.1:60684', transport: 'socket'
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.VerifyError: Catch type is not a subclass of Throwable in exception handler 46
Exception Details:
Location:
org/hotswap/agent/util/Version.version()Ljava/lang/String; @46: astore_0
Reason:
Type 'java/io/IOException' (constant pool 12) is not assignable to 'java/lang/Throwable'
Bytecode:
0000000: bb00 0259 b700 034b 1204 1205 b600 064c
0000010: 2a2b b600 072b b600 082a 1209 b600 0ac7
0000020: 0008 120b a700 092a 1209 b600 0ab0 4b12
0000030: 0db0
Exception Handler Table:
bci [0, 45] => handler: 46
Stackmap Table:
append_frame(@39,Object[#2],Object[#31])
same_locals_1_stack_item_frame(@45,Object[#32])
full_frame(@46,{},{Object[#12]})
at org.hotswap.agent.HotswapAgent.premain(HotswapAgent.java:66)
... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Starting HotswapAgent 'C:\Repos\jbrdcevm11\lib\hotswap\hotswap-agent.jar'
Disconnected from the target VM, address: '127.0.0.1:60684', transport: 'socket'
Disconnected from server
I don't know enough about the instrumentation to figure out what the error is, however, I can see in the release notes for 2024.3, that there have been changes to the standard hotswap. Perhaps there's a conflict here?
I have downgraded to 2024.2.4 again, and HotswapAgent works once more.
I managed to setup HotswapAgent and got it running last week. However, after upgrading to IntelliJ IDEA 2024.3, from 2024.2.4, I would receive the following error when debugging:
I don't know enough about the instrumentation to figure out what the error is, however, I can see in the release notes for 2024.3, that there have been changes to the standard hotswap. Perhaps there's a conflict here? I have downgraded to 2024.2.4 again, and HotswapAgent works once more.
My setup: IntelliJ IDEA Ultimate 2024.3 My project is language level 11 JDK: https://cache-redirector.jetbrains.com/intellij-jbr/jbr_dcevm-11_0_16-windows-x64-b2043.64.tar.gz from https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr11_0_16b2043.64 HotswapAgent 2.0.1 jar added to lib/hotswap in the JBR. Tomcat 9.0.96 VM Options: "-Dnashorn.args=--no-deprecation-warning -XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar" If I run the project without "-XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=fatjar", then debug starts just fine in 2024.3.