1 Reply Latest reply on Mar 26, 2008 3:38 PM by kabirkhan

    VFSClassLoaderScopingPolicy needs updating

      I'm trying to figure out how to fix the VFSClassLoaderScopingPolicy
      with the new rules for WAR classloading deployments.

      The way it works now is that when a war gets deployed, there's a seperate
      deployer that decides whether WARs (subdeployments) should be scoped.
      They are by default.

      If this is the case, then the war subdeployment will have its own Module
      and its own Domain.

      You shouldn't need any hacks anymore for "isWar" or "isWebCL"
      or looking at the top level classloader. All you need to know is whether
      Module.determineDomain() is not the default domain (therefore it is scoped)
      and Module.determineParentDomain() to know what it is scoped against.

      Of course most subdeployments other than wars will use the top level
      classloader of the whole deployment.

      I was trying to figure out what needs changing, but I got lost. :-)

      OFF TOPIC

      One thing I did find is this code in JBoss5ClassPoolFactory

       //It is scoped
       ClassLoaderSystem sys = ClassLoaderSystem.getInstance();
      
       ClassLoaderDomain domain = sys.getDomain(module.getDeterminedDomainName());
       boolean parentFirst = module.isJ2seClassLoadingCompliance();
      


      That isn't necessarily correct. It's configurable in bootstrap-beans.xml
      what the ClassLoaderSystem is.

      It look's like the only reason you do this
      is to get the domain, because you're still doing that horrible code
      that tries to determine scoping rules based on whether the resource
      visibile to the domain is the same as the resource from the classloader.

      Like I said before, this isn't going to work if the classloader doesn't export the class.

      Probably what you really want is something like the new JMX operation on the domain
      findClassLoaderForClass()
      except starting from the classloader you're handling rather than the domain?