cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to achieve hot reloading in alfresco sdk 3.0

vikash_patel
Star Contributor
Star Contributor

I am trying to achieve hot reloading by following this Using HotSwapAgent | Alfresco Documentation link.

After completing all steps when I am making changes in sample webscript java file it is giving following error and changes are not getting reflected.

Exception in thread "Thread-69" java.lang.IllegalStateException: Unable to redefine classes
at org.hotswap.agent.config.PluginManager.hotswap(PluginManager.java:276)
at org.hotswap.agent.plugin.hotswapper.HotswapperPlugin$1.executeCommand(HotswapperPlugin.java:94)
at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:25)
Caused by: java.lang.UnsupportedOperationException: class redefinition failed: attempted to add a method
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)
at org.hotswap.agent.config.PluginManager.hotswap(PluginManager.java:272)
... 2 more

Thanks,

Vikash

3 REPLIES 3

krutik_jayswal
Elite Collaborator
Elite Collaborator

Hotswap agent does not support hot reloading when you modify the class defination..

For example , below changes will not hot reload the java file.

  • Modifying the method name
  • Modifying the method parameter
  • Changing the class name
  • Adding new class etc..

Below changes will get hot reloaded.

  • Adding code inside any method
  • Modifying method body etc..

Hi Krutik,

I am only modifying code under executeImpl() method of sample webscript, then also it is giving above error.

The Error says that you have added new method in java class.Have you applied patch to JDK?