1 Reply Latest reply on Jul 12, 2007 2:43 PM by Adrian Brock

    New VFSClassLoader is nearly ready for JBoss Head

    Adrian Brock Master

      Before you get excited, this is not committed yet and its only using the old
      rules with a hacky deployer that converts
      LoaderRepositoryConfig to ClassLoaderMetaData

      It actually works pretty well once I got over two stupid problems:

      RESOURCE FILTERING

      I've got some tidying up to do here
      I realised once I'd integrated it that the way the class filtering was working
      doesn't work for resources.

      e.g.
      org.jboss.xxx.notpublic.PrivateClass
      won't be exposed if only org.jboss.xxx is exported as a package
      BUT
      org.jboss.xxx.some-resource.xml
      should be exported.

      The dot in some-resource.xml confused it because it thought some-resource
      is a package and xml the file :-)

      VFS BUG

      I also rewrote the exportAll package determination.
      There's a horrible bug in the VFS where if you do

      URI uri = file.toURI();
      VirtualFile root = VFS.getRoot(uri);
      

      it gives you back a virtual file that's has a "pathName" for jar uris.
      The path name is the name of the jar.

      Actually, the new code is a lot cleaner. :-)

      MORE TESTING

      I also broke at least one test. In a good way:-)
      This test I wrote earlier this week is failing because the new VFSClassLoader
      throws the correct SecurityException (unlike the UCL)

      20:32:22,616 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.Beta3 (build: SVNTag=JBoss_5_0_0_Beta3 date=200707101429)] Started in 40s:829ms
      20:32:58,247 INFO [MainDeployer] deploy, url=file:/home/ejort/jboss-head/testsuite/output/lib/test-java-class-isolation.sar
      20:32:58,283 WARN [ClassLoaderManager] Unexpected error during load of:java.org.jboss.test.Test
      java.lang.SecurityException: Prohibited package name: java.org.jboss.test
       at java.lang.ClassLoader.preDefineClass(ClassLoader.java:479)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
       at org.jboss.classloader.spi.base.BaseClassLoader.access$2(BaseClassLoader.java:1)
       at org.jboss.classloader.spi.base.BaseClassLoader$1.run(BaseClassLoader.java:271)
       at org.jboss.classloader.spi.base.BaseClassLoader$1.run(BaseClassLoader.java:1)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:245)
       at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:218)
       at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:75)
       at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:449)
       at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)
       at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:145)
       at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:191)
       at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:766)
       at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:479)
       at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:159)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.jboss.test.isolation.mbean.JavaClassIsolation.test(JavaClassIsolation.java:51)