[jboss-dev-forums] [Design of POJO Server] - Re: Classloader problem with NamingRestartUnitTestCase

kabir.khan@jboss.com do-not-reply at jboss.com
Wed Feb 6 06:28:08 EST 2008


Looking at 
[url]
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/trunk/classloader/src/main/org/jboss/classloader/spi/base/BaseClassLoader.java/?revision=69628&r1=69628&r2=69627[/url]


  |  if (result != null)
  | 220 	  	       {
  | 221 	  	          // Has this classloader been undeployed?
  | 222 	  	          ClassLoader otherClassLoader = getClassLoader(result);
  | 223 	  	          if (otherClassLoader != null && otherClassLoader != this && otherClassLoader instanceof RealClassLoader)
  | 224 	  	          {
  | 225 	  	             RealClassLoader rcl = (RealClassLoader) otherClassLoader;
  | 226 	  	             // Ignore when undeployed
  | 227 	  	             if (rcl.isValid() == false)
  | 228 	  	             {
  | 229 	  	                if (trace)
  | 230 	  	                   log.trace(this + " ignoring already loaded class from undeployed classloader " + ClassLoaderUtils.classToString(result));
  | 231 	  	                result = null;
  | 232 	  	             }
  | 233 	  	          }
  | 234 	  	       }
  | 

The call on 227 ends up in BaseClassLoader

  |    public boolean isValid()
  |    {
  |       BaseClassLoaderPolicy basePolicy = policy;
  |       return basePolicy.getClassLoader() != null;
  |    }
  | 

which in turn ends up in BaseClassLoaderPolicy

  |    synchronized BaseClassLoader getClassLoader()
  |    {
  |       if (classLoader == null)
  |          throw new IllegalStateException("No classloader associated with policy therefore it is no longer registered " + toLongString());
  |       return classLoader;
  |    }
  | 

So the isValid() check will throw an IllegalStateException rather than return false

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4126953#4126953

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4126953



More information about the jboss-dev-forums mailing list