Fail to look for a resource bundle that is in jdk.boot module

Mandy Chung Mandy.Chung at Sun.COM
Sat Jan 23 12:34:16 PST 2010


Hi Mark,

I have made some good progress in creating the jdk base
image and also the entire jdk image.  All jdk modules
are installed successfully on jigsaw on all platforms.
Running org.openjdk.jigsaw.Hi works!

> jdk-module-image/bin/java -m jdk.base
The JDK boot module is brought to you by the letter 'J' and the number 7.

> jre-base-image/bin/java -m jdk.base
The JDK boot module is brought to you by the letter 'J' and the number 7.

I now run into two different issues.  

In the module mode, I run into a missing resource 
exception where it fails to find a resource bundle 
that exists.  sun.launcher.resources.launcher is 
a compiled class installed in the jdk.boot module.

> ls jdk-module-image/lib/modules/jdk.boot/7-ea/classes/sun/launcher/resources/launcher.class

> jdk-module-image/bin/java -m jdk.javac
Exception in thread "main" java.lang.ExceptionInInitializerError
        at sun.launcher.LauncherHelper.getLocalizedMessage(LauncherHelper.java:71)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:211)
Caused by: java.util.MissingResourceException: Can't find bundle for base name sun.launcher.resources.launcher, locale en
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1539)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1278)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:733)
        at sun.launcher.LauncherHelper$ResourceBundleHolder.<clinit>(LauncherHelper.java:59)
        ... 2 more

Is there anything look suspicious to you? ResourceBundle uses
its own RBClassLoader to find resources.  Is it considered
as legacy mode?  Even it's legacy mode, it should be able to
find it since it's in the jdk.boot module.

How does the module loader find a resource file different
than the legacy class loader?  I just suspect this is class
loader issue.

The module-info for jdk.javac module is:

> jdk.javac/module-info.java 
module jdk.javac @ 7-ea {
    requires local public jdk.langtools @ 7-ea;
    requires local public jdk.logging @ 7-ea;
    permits jdk, jdk.tools;
    class org.openjdk.jigsaw.Hi;  // ## Testing
}

In the legacy mode, it loads sun.launcher.LauncherHelper
and finds the resource as the jdk.boot classes/resources
are added in the bootclasspath.  But I got a 
NoClassDefFoundError instead that the app classloader 
can't find com.sun.tools.javac.Main from the 
jdk.javac module.  I know that the hotspot bootclasspath
is just temporary workaround for the boot classes but not 
for all jdk modules.  But looks like we need a solution
soon.

> jdk-module-image/bin/javac -version

Error: Could not find main class com.sun.tools.javac.Main
Exception in thread "main" java.lang.NoClassDefFoundError: com.sun.tools.javac.Main
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:213)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
        at java.net.URLClassLoader$1.run(URLClassLoader.java:299)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:288)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:287)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:422)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:325)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:355)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:209)

> ls jdk-module-image/lib/modules/jdk.javac/7-ea/classes/com/sun/tools/javac/Main.class

I'll continue to dig into this further.  Any thoughts
or hints to diagnose these issues would be appreciated.

Thanks
Mandy




More information about the jigsaw-dev mailing list