11-24-2017 09:41 AM
Hi, Hotswap seen doesn't work on any artifact genration :
HOTSWAP AGENT: 15:37:42.619 RELOAD (org.hotswap.agent.config.PluginManager) - Reloading classes [com.xxx.xx.controller.SiteCustomPostController] (autoHotswap)
Exception in thread "Thread-240" java.lang.IllegalStateException: Unable to redefine classes
at org.hotswap.agent.config.PluginManager.hotswap(PluginManager.java:272)
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 change the schema (add/remove fields)
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170)
at org.hotswap.agent.config.PluginManager.hotswap(PluginManager.java:269)
... 2 more
Anywhere, I don't try to create new method or classe, just add new space on java code.
Have you the same bug?
11-28-2017 08:11 AM
AFAIK with hotswap agent you will be only able to hot reload thing which are not modifying the schema of classes.
For example if you are modifying the code inside method it will work.But if you are renaming/adding new method then it will not be able to reload it.
You can use jrebel for that i guess.
11-28-2017 11:10 AM
Thinks you for your response.
I know this point. Step to reproduce :
1) create javadir-context.xml with this content :
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"><context:component-scan base-package="com.xx.ged" />
<context:annotation-config /></beans>
2) Create Class :
@Component
public class YourClass{@Autowired
SiteBusiness siteBusiness;
public void importCsvDataToAlfresco(String text) {
System.out.println("This is message from Alfresco : " + text);
}
}
3) Start embedded server with hotswap
4) change the content text of printLn, and you have this error :
Exception in thread "Thread-240" java.lang.IllegalStateException: Unable to redefine classe
Explore our Alfresco products with the links below. Use labels to filter content by product module.