Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.util.MissingResourceException: Can't find bundle for base name c
om.geinfra.geaviation.cpc.main.res.XMLResourceMgr, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
I have tried various options but none helped. I tried adding it to the classpath, made it in a jar and added to cp, i removed gnujaxp.jar from cp. None of them helped.
I also tried placing the required XMLResourceMgr.XML file in various locations, inside and outside the package, directly inside project folder, location of the class file.. still i am getting this exception. The thing is application is running fine in Eclipse. when i export it as a jar and when i try to run it from command line i get this error. The application was working properly from command line jar mode before adding this XMLResourceMgr. but now i get this error. I have spent so much of time in this but still not able to figure it out. t not able to run this from command line.
the error is in the below block of code inside XMLResourceMgr.java class:
String res = XMLResourceMgr.class.getName();
mResourceBundle = ResourceBundle.getBundle(res, new XMLResourceBundleControl()); //error occurs in this line.
i dont actually mean that line of code is wrong. I need to do some config to make that line work. please help me on this. I am trying to read an entry from a file named XMLResourceMgr.xml
Thank God.. atlast it started working even after i lost hope of replies from ranch! it was my mistake actually. i am posting here that it might be useful to someone in the future.
It's not my own program to be honest. it is an example program for reading xml file resource bundle from the javadoc.
The subclass of ResourceBundle.Control which i defined checked for the format in .equals("xml").. but i had the file named filename.XML in uppercase!
this made me to research on this exception for around 24 hours.. if the author of the example program in the ResourceBundle javadoc had made a check for upper case formats also(.equals("XML")), then i wouldn't have learned something about this stuff. thanks to that person whoever he may be on this earth.
but make sure gnujaxp.jar is not in the classpath. it will also provide the same exception but with a little different stack trace.
subject: java.util.MissingResourceException: Can't find bundle for base name