aspose file tools*
The moose likes XML and Related Technologies and the fly likes java.util.MissingResourceException: Can't find bundle for base name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "java.util.MissingResourceException: Can Watch "java.util.MissingResourceException: Can New topic
Author

java.util.MissingResourceException: Can't find bundle for base name

Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 63

I am getting the below error:

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)
at com.XMLResourceMgr.<clinit>(XMLResour
ceMgr.java:41).

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:

static {
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
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18993
    
    8

Mohamed Iqzas wrote:I tried adding it to the classpath...


What is "it" in that sentence?
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 63

"it" is the XML file that i want to access from the program. The program is giving output from eclipse but when i export it as a jar and run it from command line i'm geting this exception.
Mohamed Iqzas
Ranch Hand

Joined: Jan 02, 2012
Posts: 63

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.
 
wood burning stoves
 
subject: java.util.MissingResourceException: Can't find bundle for base name