If this is an inbound agent you should add an add-opens to the java call
java --add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED -jar agent.jar ...
for outbound agents (ssh) there is an JVM options field where you should add this
--add-opens java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED