Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ClassLoader problem

0 views
Skip to first unread message

Marco Alberti

unread,
Oct 8, 1999, 3:00:00 AM10/8/99
to
Hello,

I defined a custom ClassLoader in a JVM 1.2 environment to read my
application's classes and resources from a "store" repository contained
in a zip file.

The new class loader works fine with java classes, but fails to load the
related resource properties, during the automatic resolving process:

Looking for class: MyResources
Res name: store/MyResources.class
Class Loaded Name: MyResources
Looking for class: java.util.MissingResourceException
Looking for class: java.util.Locale
Looking for class: java.util.ResourceBundle
Looking for class: Resources_en
Res name: store/Resources_en.class
Class Loader:
Resource name: Resources_en.properties
java.lang.ClassFormatError: Resources_en (Bad magic number)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:378)
at MCL.myLoad(MCL.java:121)
at MCL.loadClass(MCL.java:60)
at java.lang.ClassLoader.loadClass(ClassLoader.java:237)
at java.util.ResourceBundle.findBundle(ResourceBundle.java:504)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:412)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:348)
at MyResources.getResource(MyResources.java:27)

I don't understand why the loader doesn't use
super.getResourceAsStream(..) (for example) to read the properties file,
instead of the loadClass() method, that is the only one that I have
overridden!

Does anyone have any idea about that?

Thank you.

Marco


0 new messages