Hotswap does not work in the custom plugin

152 views
Skip to first unread message

Robert Carnecky

unread,
Apr 28, 2019, 10:55:16 PM4/28/19
to HotswapAgent
I am writing my custom plugin for a very specific framework. The framework saves everything in jar files (even resources like images are saved in jar files) and there is a dedicated class loader instance for each jar file. Years ago I wrote the plugin for JRebel - I modified the class loader to load and hot-swap files from my build/class directory instead of from the jar file. Easy.

Now I would like to do the same work with HA. In my HA plugin, I patched the class loader to implement the interface HotswapAgentClassLoaderExt and updated the hotswap-agent.properties - watchResources are pointing to my build/resources dir and extraClasspath is pointing to my compiled build/classes dir, autoHotswap is true.  Resources watcher is working as expected and discovers all changes. However, I do not see any activity on the class file changes. I traced the watchReload() method where the reload commands should be created and I see there are no calls for this method on a class file update. The  HotswapperPlugin is properly initialized on the class loader so either I am doing anything wrong in the configuration (I see a bit mismatch in the documentation about the usage of watchResources and extraClasspath) or the HotswapperPlugin does not work well with the framework. 

Any idea where I should start tracking the issue? BTW, probably due to a large number of class loader instances I see a lot of the following log entries, IMO this could stay hidden.

HOTSWAP AGENT: 03:59:53.981 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []
HOTSWAP AGENT: 03:59:54.750 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []
HOTSWAP AGENT: 03:59:55.064 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []
HOTSWAP AGENT: 03:59:55.218 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []
HOTSWAP AGENT: 03:59:55.293 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []
HOTSWAP AGENT: 03:59:55.471 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: []

vladimir dvorak

unread,
Jun 21, 2019, 5:04:29 PM6/21/19
to HotswapAgent
 I'm sorry for delay. Your classloader must supply extraClasspath directories via classloader.getResources()
It is used in WatchHandler, look at :

Reply all
Reply to author
Forward
0 new messages