I am trying to use HotSwapAgent for the first time, i have a java 17 project that i want to run this on but i am hitting the follow issue -
http://hotswapagent.org/mydoc_quickstart-jdk17.html shows only how to do this with JBR for java 17. Is it possible to do this with any jre?
When i use it on amazon correto i get
Unrecognized VM option 'AllowEnhancedClassRedefinition'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
When i pass
-javaagent:/path/hotswap-agent-1.4.1.jar as a VM option i see the following logs
HOTSWAP AGENT: 17:26:05.745 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {unkown} - unlimited runtime class redefinition.
HOTSWAP AGENT: 17:26:06.116 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.hotswapper.HotswapperPlugin' initialized in ClassLoader 'jdk.internal.loader.ClassLoaders$AppClassLoader@251a69d7'.
HOTSWAP AGENT: 17:26:06.173 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [Hotswapper, JdkPlugin, AnonymousClassPatch, ClassInitPlugin, WatchResources, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis]
but when i use javassit to modify a method there is no log indicate that a change was caught
Any ideas if this is achievable without JBR on java 17? I want to create a REST API which will modify classes in order to add log entries dynamically after service has already started.
Regards,
Orhan