Tomcat default classlLoader
is WebappClassLoader
, but you need `TomcatInstrumentableClassLoader.
There are two solutions:
- Modify WebappLoader.class
Change WebappLoader.java
private String loaderClass = "org.apache.catalina.loader.WebappClassLoader";
Replace:
private String loaderClass = "org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader";
Compile it and replaced the class file(catalina.jar), then it works.
Here is required dependency jars: catalina.jar
,tomcat-coyote.jar
,tomcat-util.jar(/bin)
,tomcat-juli.jar
- Modify context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
</Context>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…