VMClassLoader.getBootPackages only looks at the first URL returned by getResources. This is a problem in case this first entry is the META-INF/INDEX.LIST of an endorsed jar instead of glibj.zip. In this case the boot packages are not found. The following is a patch against VMClassLoader.java of CACAO that solves the problem by reading the package lists of all URLs returned by getResources: Index: src/lib/vm/reference/java/lang/VMClassLoader.java =================================================================== --- src/lib/vm/reference/java/lang/VMClassLoader.java (revision 4867) +++ src/lib/vm/reference/java/lang/VMClassLoader.java (working copy) @@ -265,12 +265,15 @@ */ private static String[] getBootPackages() { - URL indexList = getResource("META-INF/INDEX.LIST"); - if (indexList != null) - { + Enumeration urls = getResources("META-INF/INDEX.LIST"); + Set packageSet = new HashSet(); + + while (urls.hasMoreElements()) + { + URL indexList = (URL) urls.nextElement(); + try { - Set packageSet = new HashSet(); String line; int lineToSkip = 3; BufferedReader reader = new BufferedReader( @@ -289,15 +292,12 @@ lineToSkip--; } reader.close(); - return (String[]) packageSet.toArray(new String[packageSet.size()]); } catch (IOException e) { - return new String[0]; } - } - else - return new String[0]; + } + return (String[]) packageSet.toArray(new String[packageSet.size()]); }
Created attachment 11390 [details] example patch fixing the problem in CACAO's VMClassLoader.java
This prevents the work of Classpath with JOnAS J2EE server. GNU Classpath CORBA classes cannot load the plugged in JacORB implementation because the JacORB classes are in the endorsed jar. Setting severity to major, JOnAS is an important application and this bug is a blocker for it. This was discussed at http://forge.objectweb.org/tracker/index.php?func=detail&aid=305915&group_id=26&atid=100026 on the ObjectWeb.
I am not sure the JacORB bug is related to this one. The current bug is about the fact that META-INF/INDEX.LIST is not found if the boot classpath contains a META-INF/INDEX.LIST entry which is not the one of the glibj.zip. Not finding this entry means that the ClassLoader.getPackage(String) returns null for core packages (like "java.lang" e.g.). I can eventually handle this bug this week end, but I'm not certain it is the one which is linked to the failure or JacORB.