• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



What is "it" in that sentence?
 
Mohamed Iqzas
Ranch Hand
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
Posts: 77
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic