Thread.currentThread().setContextClassLoader(classLoader);
// The moment an instrumented class comes up it does AspectManager.instance(classLoader), which
// should return the classLoader created above. So we tie in a class loader scoping policy.
// Note that this won't work in AS.
AOPClassLoaderScopingPolicy classLoaderScopingPolicy = new AOPClassLoaderScopingPolicy() {
public Domain getDomain(ClassLoader classLoader, AspectManager parent)
{
//log.debug("getDomain");
if(classLoader instanceof DomainClassLoader)
return ((DomainClassLoader) classLoader).getDomain();