i am trying to use the HotSwapAgent in our Project. We are using a Wildfly 10.x and our Project is deployed as an exploded EAR in which there is an exploded war. I've added the following JVM-options:
-XXaltjvm=dcevm -javaagent:c:\dev\hotswap-agent.jar
When my WildFly is deploying i get the following Error:
HOTSWAP AGENT: 14:42:40.479 ERROR (org.hotswap.agent.plugin.spring.scanner.XmlBeanDefinationScannerAgent) - failed to convert filePath /C:/dev/projects/project_abc/abc/ABC/target/ABC_Exploded.ear/ABCWeb.war/WEB-INF/config/spring/soap-context.xml to classPath path
When i let the Wildfly run, later the following Error is shown and the Deployment fails.
rror creating bean with name 'systemConfigurationService' defined in ServletContext resource [/WEB-INF/config/spring/service-maintenance-context.xml]: Invocation of init method failed; nested exception is java.lang.reflect.UndeclaredThrowableException
Does anyone know how to configure this right ? I've read that you can put an extraClassPath into the properties of the HotswapAgent but i've no clue what i should set.
You have to change the convertToClasspathURL in org.hotswap.agent.plugin.spring.scanner.XmlBeanDefinationScannerAgent in order to your needs.
Seems in your case above just the following to the method:
paths = filePath.split("WEB-INF/config/spring");
if (paths.length == 2) {
return paths[1];
}
convertToClasspathURL ( after modifying it for your classpath needs ) :
private static String convertToClasspathURL(String filePath) {
String[] paths = filePath.split("src/main/resources/");
if (paths.length == 2) {
return paths[1];
}
paths = filePath.split("WEB-INF/classes/");
if (paths.length == 2) {
return paths[1];
}
paths = filePath.split("target/classes/");
if (paths.length == 2) {
return paths[1];
}
paths = filePath.split("target/test-classes/");
if (paths.length == 2) {
return paths[1];
}
paths = filePath.split("WEB-INF/config/spring");
if (paths.length == 2) {
return paths[1];
}
LOGGER.error("failed to convert filePath {} to classPath path", filePath);
return filePath;
}
Hope it solves your problem!