Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resource Bundle Missing Error in iReport

 
sami burasami
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am Facing serious problem with base resource bundle error.
I have to translate the report as per requirement from one language to another by choosing locale. So I have created a properties file for each language such as xxxx_de_DE, xxxx_en_US.. etc .. I have place this files along with my jasper files in a location.
My report is running fine while I am running from iReport3.1.. but when I try to run through my java application its gives the following error..


java.util.MissingResourceException: Can't find bundle for base name invoice_header_backup, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:837)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:727)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:700)
at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:572)
at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:510)
at net.sf.jasperreports.engine.fill.JRFillDataset.loadResourceBundle(JRFillDataset.java:527).


i have tried a lot more over this issue.. but I can’t able overcome this problem.. any please suggest me.. how to overcome this problem.. thanks in advance…
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to Javaranch!

How are you reading in the ResourceBundle and where is that ResourceBundle stored? It sounds like its a typical CLASSPATH issue (the ResourceBundle must be on the CLASSPATH of your Java application if yuo're using the fairly standard way of retrieving them).
 
sami burasami
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You for your reply...
i am run the jasper report through my java application.
for example.
i have stored my *.jasper files in C:\jasper\ location. and also i have place my *_en_US.properties file in that location...
for my jasper file i have given some path in my class file.. like the following



whether i have to give any path for this properties also?
if its how can i give the path for properties file...

thanks in advance..
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: You want to look at the method called getResourceAsStream(). You probably also want to avoid having absolute paths that are dependent on one server (e.g. Not every server will have c:\, especially non windows ones!).
 
sami burasami
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks For your reply.
for your understand only i have stated like that path.. but i am using the class for find that file..
sorry i can't get your hint which you stated as


can you explain little bit more. regarding how can get that *_en_US file and how can i pass that file to my jasper file.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I would read this sun article and have a look at this code sample
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic