HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.36k stars 493 forks source link

Spring plugin doesn't work on wildfly 12 #269

Closed aekrylov closed 5 years ago

aekrylov commented 6 years ago

I'm using hotswap agent 1.3.0 with Spring plugin enabled for war packaged web app on Wildfly 12. The agent is attached via the command line (i.e. -XXaltjvm=dcevm -javaagent:%JBOSS_HOME%\bin\webbpm-hotswap-agent.jar"). Classes are reloaded through JPDA. Core hotswap features work just fine, though the Spring plugin doesn't refresh components. Spring is initialized through WebAppInitializers, with component scan enabled with annotations in config classes. I tried managed war and exploded deployments as well as unmanaged exploded deployment, neither of which works. On the app startup, i see warnings like that in Wildfly logs:

HOTSWAP AGENT: 18:04:54.439 WARNING (org.hotswap.agent.watch.nio.TreeWatcherNIO) - Unable to watch for path vfs:/C:/jboss-home/standalone/data/managed-exploded/backend.war/WEB-INF/classes/service/, not a local regular file or directory.

Is there something else I should do to make the plugin work?

aekrylov commented 6 years ago

When using exploded deployments, I see following errors during the hotswap:

 HOTSWAP AGENT: 18:07:00.881 ERROR (org.hotswap.agent.util.signature.ClassSignatureComparerHelper) - Error reading siganture
 org.hotswap.agent.javassist.NotFoundException: lib_package.LibClass
    at org.hotswap.agent.javassist.ClassPool.get(ClassPool.java:445)
    at org.hotswap.agent.javassist.CtClassType.getSuperclass(CtClassType.java:780)
    at org.hotswap.agent.util.signature.CtClassSignature.getValue(CtClassSignature.java:69)
    at org.hotswap.agent.util.signature.ClassSignatureComparerHelper.getCtClassSignature(ClassSignatureComparerHelper.java:21)
    at org.hotswap.agent.util.signature.ClassSignatureComparerHelper.isDifferent(ClassSignatureComparerHelper.java:37)
    at org.hotswap.agent.util.signature.ClassSignatureComparerHelper.isPoolClassDifferent(ClassSignatureComparerHelper.java:64)
    at org.hotswap.agent.plugin.spring.signature.ClassSignatureComparer.isPoolClassDifferent(ClassSignatureComparer.java:31)
    at org.hotswap.agent.plugin.spring.SpringChangesAnalyzer.classChangeNeedsReload(SpringChangesAnalyzer.java:43)
    at org.hotswap.agent.plugin.spring.SpringChangesAnalyzer.isReloadNeeded(SpringChangesAnalyzer.java:36)
    at org.hotswap.agent.plugin.spring.SpringPlugin$1.transform(SpringPlugin.java:108)
    at org.hotswap.agent.util.HotswapTransformer.transform(HotswapTransformer.java:189)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)

The class in error is a superclass of a spring Component class being hotswapped, and is located in the jar under WEB-INF/lib