public class TomcatInstrumentableClassLoader
extends org.apache.catalina.loader.WebappClassLoader
To be registered using a
<a href="http://tomcat.apache.org/tomcat-5.5-doc/config/loader.html">Loader</a> tag
in Tomcat's <a href="http://tomcat.apache.org/tomcat-5.5-doc/config/context.html">Context</a>
definition in the server.xml file, with the Spring-provided "spring-instrument-tomcat.jar"
file deployed into Tomcat's "server/lib" (for Tomcat 5.x) or "lib" (for Tomcat 6.x) directory.
The required configuration tag looks as follows:
<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>
Typically used in combination with a
ReflectiveLoadTimeWeaver
defined in the Spring application context. The addTransformer and
getThrowawayClassLoader methods mirror the corresponding methods
in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver.
See the PetClinic sample application for a full example of this ClassLoader in action.
NOTE: Requires Apache Tomcat version 5.0 or higher.
addTransformer(java.lang.instrument.ClassFileTransformer),
getThrowawayClassLoader(),
ReflectiveLoadTimeWeaverallPermission, delegate, ENABLE_CLEAR_REFERENCES, files, hasExternalRepositories, jarFiles, jarNames, jarPath, jarRealFiles, lastJarAccessed, lastModifiedDates, loaderDir, loaderPC, log, needConvert, notFoundResources, packageTriggers, parent, paths, permissionList, repositories, repositoryURLs, resourceEntries, resources, securityManager, sm, started, system, triggers| Constructor and Description |
|---|
TomcatInstrumentableClassLoader()
Create a new
TomcatInstrumentableClassLoader using the
current context class loader. |
TomcatInstrumentableClassLoader(ClassLoader parent)
Create a new
TomcatInstrumentableClassLoader with the
supplied class loader as parent. |
| Modifier and Type | Method and Description |
|---|---|
void |
addTransformer(ClassFileTransformer transformer)
Delegate for LoadTimeWeaver's
addTransformer method. |
protected org.apache.catalina.loader.ResourceEntry |
findResourceInternal(String name,
String path) |
ClassLoader |
getThrowawayClassLoader()
Delegate for LoadTimeWeaver's
getThrowawayClassLoader method. |
String |
toString() |
addLifecycleListener, addPermission, addPermission, addPermission, addRepository, addURL, clearReferences, closeJARs, deleteDir, filter, findClass, findClassInternal, findLifecycleListeners, findLoadedClass0, findLoadedResource, findRepositories, findResource, findResourceInternal, findResources, getAntiJARLocking, getDelegate, getJarPath, getPermissions, getResource, getResourceAsStream, getResources, getURI, getURL, getURLs, isPackageSealed, loadClass, loadClass, loadedByThisOrChild, modified, nullInstance, openJARs, refreshPolicy, removeLifecycleListener, setAntiJARLocking, setDelegate, setJarPath, setParentClassLoader, setResources, setWorkDir, start, stop, validate, validateJarFileclose, definePackage, newInstance, newInstancedefineClass, defineClassclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic TomcatInstrumentableClassLoader()
TomcatInstrumentableClassLoader using the
current context class loader.public TomcatInstrumentableClassLoader(ClassLoader parent)
TomcatInstrumentableClassLoader with the
supplied class loader as parent.parent - the parent ClassLoader to be usedpublic void addTransformer(ClassFileTransformer transformer)
addTransformer method.
Typically called through ReflectiveLoadTimeWeaver.public ClassLoader getThrowawayClassLoader()
getThrowawayClassLoader method.
Typically called through ReflectiveLoadTimeWeaver.protected org.apache.catalina.loader.ResourceEntry findResourceInternal(String name, String path)
findResourceInternal in class org.apache.catalina.loader.WebappClassLoaderpublic String toString()
toString in class org.apache.catalina.loader.WebappClassLoader