Social Media
  • You are here:
  • Home »
  • Uncategorized »

InvocationTargetException in transform method on plugin ‘class WebappClassLoader’

I really like hotswapagent but had the above error on start up. I had to do some digging – but concluded there was nothing to worry about, and the code is simply checking the old location and the new location for the WebappClassLoader

I had seen a post with a similar error on Tomcat8, but Im running Apache Tomcat/7.0.69. The exception is listed below – but here is my analysis.

The method org.hotswap.agent.plugin.tomcat.WebappLoaderTransformer.patchWebappClassLoader first tries to find getResource in tomcats WebappClassLoader, but doesnt find it. It then tries WebappClassLoaderBase and starts successfully?

The Hotswapagent states that this method is in WebappClassLoaderBase for tomcat8, and WebappClassLoader for 7 but I checked the tomcat code –

And it confirms that it is WebappClassLoaderBase for 7 too

Everything looks ok to me and the plugin has started – but thought this post might be of interest

Exception –

HOTSWAP AGENT: 9:54:35.317 ERROR (org.hotswap.agent.annotation.handler.OnClassLoadedHandler) – InvocationTargetException in transform method on plugin ‘class org.hotswap.agent.plugin.tomcat.TomcatPlugin’ class ‘org/apache/catalina/loader/WebappClassLoader’.
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.hotswap.agent.annotation.handler.OnClassLoadedHandler.transform(
at org.hotswap.agent.annotation.handler.OnClassLoadedHandler$1.transform(
at org.hotswap.agent.util.HotswapTransformer.transform(
at sun.instrument.TransformerManager.transform(
at sun.instrument.InstrumentationImpl.transform(
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(
at Method)
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at org.apache.catalina.loader.WebappLoader.createClassLoader(
at org.apache.catalina.loader.WebappLoader.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.StandardContext.startInternal(
at org.apache.catalina.util.LifecycleBase.start(
at org.apache.catalina.core.ContainerBase$
at org.apache.catalina.core.ContainerBase$
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.hotswap.agent.javassist.NotFoundException: getResource(..) is not found in org.apache.catalina.loader.WebappClassLoader
at org.hotswap.agent.javassist.CtClassType.getDeclaredMethod(
at org.hotswap.agent.plugin.tomcat.WebappLoaderTransformer.patchWebappClassLoader(
… 33 more

HOTSWAP AGENT: 9:54:35.411 INFO (org.hotswap.agent.config.PluginRegistry) – Plugin ‘org.hotswap.agent.plugin.tomcat.TomcatPlugin’ initialized in ClassLoader ‘WebappClassLoader
delegate: false
———-> Parent Classloader:
HOTSWAP AGENT: 9:54:35.411 INFO (org.hotswap.agent.plugin.tomcat.TomcatPlugin) – Tomcat plugin initialized – Tomcat version ‘’

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: