Index: ejb3/src/test/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java
===================================================================
--- ejb3/src/test/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	(revision 68137)
+++ ejb3/src/test/org/jboss/ejb3/test/cachepassivation/unit/CachePassivationUnitTestCase.java	(working copy)
@@ -25,25 +25,21 @@
 
 import javax.naming.InitialContext;
 
+import junit.framework.TestCase;
+
 import org.jboss.aop.AspectManager;
 import org.jboss.cache.transaction.DummyTransactionManager;
 import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.Ejb3Registry;
-import org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager;
-import org.jboss.ejb3.cache.simple.StatefulSessionPersistenceManager;
 import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
 import org.jboss.ejb3.stateful.StatefulBeanContext;
-import org.jboss.ejb3.stateful.StatefulContainer;
 import org.jboss.ejb3.test.cachepassivation.MockBean;
 import org.jboss.ejb3.test.cachepassivation.MockDeploymentUnit;
 import org.jboss.ejb3.test.cachepassivation.MockEjb3Deployment;
 import org.jboss.ejb3.test.cachepassivation.MockStatefulContainer;
-import org.jboss.ejb3.test.cachepassivation.MyStatefulSessionFilePersistenceManager;
 import org.jboss.naming.JavaCompInitializer;
 import org.jnp.server.SingletonNamingServer;
 
-import junit.framework.TestCase;
-
 /**
  * Comment
  *
@@ -72,7 +68,7 @@
       String beanClassName = MockBean.class.getName();
       String ejbName = "MockBean";
       AspectManager aspectManager = new AspectManager();
-      InterceptorInfoRepository interceptorRepository = new InterceptorInfoRepository();
+      InterceptorInfoRepository interceptorRepository = new InterceptorInfoRepository(cl);
       Ejb3Deployment deployment = new MockEjb3Deployment(new MockDeploymentUnit(), null);
       MockStatefulContainer container = new MockStatefulContainer(cl, beanClassName, ejbName, aspectManager, ctxProperties, interceptorRepository, deployment);
       container.instantiated();
Index: ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java
===================================================================
--- ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java	(revision 68137)
+++ ejb3/src/test/org/jboss/ejb3/test/cachepassivation/MockEjb3Deployment.java	(working copy)
@@ -50,11 +50,9 @@
  */
 public class MockEjb3Deployment extends Ejb3Deployment
 {
-   private Ejb3Deployer deployer = new Ejb3Deployer();
-   
    public MockEjb3Deployment(DeploymentUnit unit, DeploymentScope deploymentScope)
    {
-      super(unit, deploymentScope, null, null, null);
+      super(unit, deploymentScope, null, null, new Ejb3Deployer());
       PoolFactoryRegistry poolRegistry = new PoolFactoryRegistry();
       HashMap<String, Class<? extends PoolFactory>> poolFactories = new HashMap<String, Class<? extends PoolFactory>>();
       poolFactories.put("ThreadlocalPool", ThreadlocalPoolFactory.class);
@@ -71,12 +69,6 @@
    }
 
    @Override
-   public Ejb3Deployer getDeployer()
-   {
-      return deployer;
-   }
-
-   @Override
    public DependencyPolicy createDependencyPolicy(JavaEEComponent component)
    {
       return new JBoss5DependencyPolicy(component);
Index: ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java
===================================================================
--- ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java	(revision 68137)
+++ ejb3/src/main/org/jboss/ejb3/deployers/JBoss5DeploymentUnit.java	(working copy)
@@ -1,199 +1,210 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, Red Hat Middleware LLC., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ejb3.deployers;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
-import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
-
-/**
- * Comment
- *
- * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision: 43304 $
- */
-public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
-{
-   private VFSDeploymentUnit unit;
-   private InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository();
-   private Map defaultPersistenceProperties;
-
-   public JBoss5DeploymentUnit(VFSDeploymentUnit unit)
-   {
-      this.unit = unit;
-   }
-
-   public VirtualFile getRootFile()
-   {
-      return unit.getFile("");
-   }
-   
-   public URL getRelativeURL(String jar)
-   {
-      try
-      {
-         return new URL(jar);
-      }
-      catch (MalformedURLException e)
-      {
-         try
-         {
-            if (getUrl() == null)
-               throw new RuntimeException("relative <jar-file> not allowed when standalone deployment unit is used");
-            return new URL(getUrl(), jar);
-         }
-         catch (Exception e1)
-         {
-            throw new RuntimeException("could not find relative path: " + jar, e1);
-         }
-      }
-   }
-
-   URL extractDescriptorUrl(String resource)
-   {
-      try
-      {
-         VirtualFile vf = unit.getMetaDataFile(resource);
-         if (vf == null) return null;
-         return vf.toURL();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public URL getPersistenceXml()
-   {
-      return extractDescriptorUrl("persistence.xml");
-   }
-
-   public URL getEjbJarXml()
-   {
-      return extractDescriptorUrl("ejb-jar.xml");
-   }
-
-   public URL getJbossXml()
-   {
-      return extractDescriptorUrl("jboss.xml");
-   }
-
-   public VirtualFile getMetaDataFile(String name)
-   {
-      return unit.getMetaDataFile(name);
-   }
-   
-   public List<Class> getClasses()
-   {
-      return null;
-   }
-
-   public ClassLoader getClassLoader()
-   {
-      return unit.getClassLoader();
-   }
-
-   public ClassLoader getResourceLoader()
-   {
-      return unit.getClassLoader();
-   }
-
-   public String getShortName()
-   {
-      return unit.getFile("").getName();
-   }
-
-   public URL getUrl()
-   {
-      try
-      {
-         return unit.getFile("").toURL();
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-
-   public String getDefaultEntityManagerName()
-   {
-      String url = getUrl().toString();
-      String name = url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
-      return name;
-   }
-
-   public Map getDefaultPersistenceProperties()
-   {
-      return defaultPersistenceProperties;
-   }
-
-   public void setDefaultPersistenceProperties(Map defaultPersistenceProperties)
-   {
-      this.defaultPersistenceProperties = defaultPersistenceProperties;
-   }
-
-   public Hashtable getJndiProperties()
-   {
-      return null;
-   }
-
-   public InterceptorInfoRepository getInterceptorInfoRepository()
-   {
-      return interceptorInfoRepository;
-   }
-
-   public List<VirtualFile> getResources(VirtualFileFilter filter)
-   {
-      VisitorAttributes va = new VisitorAttributes();
-      va.setLeavesOnly(true);
-      SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
-      va.setRecurseFilter(noJars);
-      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
-
-      try
-      {
-         VirtualFile root = getRootFile();
-         if( root.isLeaf() == false )
-            root.visit(visitor);
-      }
-      catch (IOException e)
-      {
-         throw new RuntimeException(e);
-      }
-      
-      List<VirtualFile> resources = visitor.getMatched();
-      
-      return resources;
-   }
-}
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, Red Hat Middleware LLC., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ejb3.deployers;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.ejb3.interceptor.InterceptorInfoRepository;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ * @version $Revision: 43304 $
+ */
+public class JBoss5DeploymentUnit implements org.jboss.ejb3.DeploymentUnit
+{
+   private VFSDeploymentUnit unit;
+   private ClassLoader classLoader;
+   private InterceptorInfoRepository interceptorInfoRepository;
+   private Map defaultPersistenceProperties;
+
+   public JBoss5DeploymentUnit(VFSDeploymentUnit unit)
+   {
+      this(unit, unit.getClassLoader());
+   }
+   
+   public JBoss5DeploymentUnit(VFSDeploymentUnit unit, ClassLoader classLoader)
+   {
+      assert unit != null : "unit is null";
+      assert classLoader != null : "classLoader is null";
+      
+      this.unit = unit;
+      this.classLoader = classLoader;
+      this.interceptorInfoRepository = new InterceptorInfoRepository(classLoader);
+   }
+
+   public VirtualFile getRootFile()
+   {
+      return unit.getFile("");
+   }
+   
+   public URL getRelativeURL(String jar)
+   {
+      try
+      {
+         return new URL(jar);
+      }
+      catch (MalformedURLException e)
+      {
+         try
+         {
+            if (getUrl() == null)
+               throw new RuntimeException("relative <jar-file> not allowed when standalone deployment unit is used");
+            return new URL(getUrl(), jar);
+         }
+         catch (Exception e1)
+         {
+            throw new RuntimeException("could not find relative path: " + jar, e1);
+         }
+      }
+   }
+
+   URL extractDescriptorUrl(String resource)
+   {
+      try
+      {
+         VirtualFile vf = unit.getMetaDataFile(resource);
+         if (vf == null) return null;
+         return vf.toURL();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public URL getPersistenceXml()
+   {
+      return extractDescriptorUrl("persistence.xml");
+   }
+
+   public URL getEjbJarXml()
+   {
+      return extractDescriptorUrl("ejb-jar.xml");
+   }
+
+   public URL getJbossXml()
+   {
+      return extractDescriptorUrl("jboss.xml");
+   }
+
+   public VirtualFile getMetaDataFile(String name)
+   {
+      return unit.getMetaDataFile(name);
+   }
+   
+   public List<Class> getClasses()
+   {
+      return null;
+   }
+
+   public ClassLoader getClassLoader()
+   {
+      return classLoader;
+   }
+
+   public ClassLoader getResourceLoader()
+   {
+      return getClassLoader();
+   }
+
+   public String getShortName()
+   {
+      return unit.getFile("").getName();
+   }
+
+   public URL getUrl()
+   {
+      try
+      {
+         return unit.getFile("").toURL();
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+
+   public String getDefaultEntityManagerName()
+   {
+      String url = getUrl().toString();
+      String name = url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
+      return name;
+   }
+
+   public Map getDefaultPersistenceProperties()
+   {
+      return defaultPersistenceProperties;
+   }
+
+   public void setDefaultPersistenceProperties(Map defaultPersistenceProperties)
+   {
+      this.defaultPersistenceProperties = defaultPersistenceProperties;
+   }
+
+   public Hashtable getJndiProperties()
+   {
+      return null;
+   }
+
+   public InterceptorInfoRepository getInterceptorInfoRepository()
+   {
+      return interceptorInfoRepository;
+   }
+
+   public List<VirtualFile> getResources(VirtualFileFilter filter)
+   {
+      VisitorAttributes va = new VisitorAttributes();
+      va.setLeavesOnly(true);
+      SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
+      va.setRecurseFilter(noJars);
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, va);
+
+      try
+      {
+         VirtualFile root = getRootFile();
+         if( root.isLeaf() == false )
+            root.visit(visitor);
+      }
+      catch (IOException e)
+      {
+         throw new RuntimeException(e);
+      }
+      
+      List<VirtualFile> resources = visitor.getMatched();
+      
+      return resources;
+   }
+}
Index: ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java
===================================================================
--- ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java	(revision 68137)
+++ ejb3/src/main/org/jboss/ejb3/JmxDeploymentUnit.java	(working copy)
@@ -47,12 +47,13 @@
  * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
  * @version $Revision$
  */
+@Deprecated
 public class JmxDeploymentUnit implements DeploymentUnit
 {
    protected static final Logger log = Logger.getLogger(JmxDeploymentUnit.class);
 
    private DeploymentInfo deploymentInfo;
-   InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository();
+   InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository(null);
    private VirtualFile vfsRoot;
 
    public JmxDeploymentUnit(DeploymentInfo deploymentInfo)
Index: ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java
===================================================================
--- ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java	(revision 68137)
+++ ejb3/src/main/org/jboss/ejb3/embedded/EJB3StandaloneDeployer.java	(working copy)
@@ -75,7 +75,7 @@
       private ClassLoader loader;
       private Map defaultProps;
       private Hashtable jndiProperties;
-      private InterceptorInfoRepository interceptorInfoRepository = new InterceptorInfoRepository();
+      private InterceptorInfoRepository interceptorInfoRepository;
       private VirtualFile vfsRoot;
 
       public DeployerUnit(ClassLoader loader, URL url, Map defaultProps, Hashtable jndiProperties)
@@ -104,6 +104,7 @@
          {
             throw new RuntimeException();
          }
+         this.interceptorInfoRepository = new InterceptorInfoRepository(loader);
       }
 
       public VirtualFile getRootFile()
Index: ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java
===================================================================
--- ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java	(revision 68137)
+++ ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java	(working copy)
@@ -78,6 +78,8 @@
 {
    private static Logger log = Logger.getLogger(InterceptorInfoRepository.class);
 
+   private ClassLoader classLoader;
+   
    private Set<String> beanClasses = new HashSet<String>();
 
    private InterceptorsMetaData interceptorsXml;
@@ -92,8 +94,11 @@
    
    private InterceptorSorter sorter = new InterceptorSorter();
 
-   public InterceptorInfoRepository()
+   public InterceptorInfoRepository(ClassLoader classLoader)
    {
+      assert classLoader != null : "classLoader is null";
+      
+      this.classLoader = classLoader;
    }
 
    public void initialise(JBossMetaData dd)
@@ -518,11 +523,13 @@
    {
       try
       {
-         return Thread.currentThread().getContextClassLoader().loadClass(name);
+         if(log.isTraceEnabled())
+            log.trace("Loading interceptor " + name + " from " + classLoader);
+         return classLoader.loadClass(name);
       }
-      catch (Exception e)
+      catch (ClassNotFoundException e)
       {
-         throw new RuntimeException("Interceptor class not found: " + name);
+         throw new RuntimeException("Interceptor class not found: " + name + " in class loader " + classLoader, e);
       }
    }
 
