anupp1983 Posted August 3, 2012 Share Posted August 3, 2012 Hi, I am usnig jasper report4.0.1.Actually i want to generate internatilization report but i m facing issue error is--but proepriies file is there and jrxml also..I am sending the code plz verify my code where i m stucking code in jrxml or java code.plz help me... Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name localization, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260) at java.util.ResourceBundle.getBundle(ResourceBundle.java:962) at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:571) at net.sf.jasperreports.engine.util.JRResourcesUtil.loadResourceBundle(JRResourcesUtil.java:509) at net.sf.jasperreports.engine.fill.JRFillDataset.loadResourceBundle(JRFillDataset.java:533) at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:568) at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1280) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:901) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624) at client.LocalizationDemoReportFill.main(LocalizationDemoReportFill.java:41)Process exited with exit code 1. Thanks& RegadsAnup Code:package client;import java.io.IOException;import java.io.InputStream;import java.util.HashMap;import java.util.Locale;import java.util.Properties;import net.sf.jasperreports.engine.JREmptyDataSource;import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JRParameter;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperExportManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.JasperReport;import net.sf.jasperreports.view.JasperViewer;public class LocalizationDemoReportFill { private static final String PROP_FILE="localization.properties"; public static void main(String[] args) { // Read properties file. Properties properties = new Properties(); String text1=null; try { InputStream is = LocalizationDemoReportFill.class.getResourceAsStream(PROP_FILE); properties.load(is); text1 = properties.getProperty("localization.text1"); System.out.println("Prop key val------- "+text1); HashMap parameterMap = new HashMap(); parameterMap.put(JRParameter.REPORT_LOCALE,Locale.ENGLISH); System.out.println("Filling report..."); String str_reportName="C:\\Users\\admin\\Desktop\\LocalizationDemoReport.jrxml"; JasperReport jasperReport =JasperCompileManager.compileReport(str_reportName); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,parameterMap,new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile(jasperPrint, "D://val12.pdf"); JasperViewer.viewReport(jasperPrint); System.out.println("Done!"); } catch (IOException e) { } catch (JRException e) { } }} Link to comment Share on other sites More sharing options...
ruffp Posted January 24, 2013 Share Posted January 24, 2013 I have exactly the same problem. My jasper reports (jrxml) and resource bundles are in a subfolder of the current classpath like this: WEB-INF/classes/jasper-templates/. Did you solve the problem? Link to comment Share on other sites More sharing options...
ruffp Posted March 14, 2013 Share Posted March 14, 2013 I sort the problem by putting the resource_bundle files in the classpath of the war application. My jasper templates are located in: "mywebapp/WEB-INF/classes/jasper-templates/myjasper.jrxml" But I had to put the resource bundle in the parent folder which was the only accessible at runtime: "mywebapp/WEB-INF/classes/mybundle.properties"Hope this can help Link to comment Share on other sites More sharing options...
debasishsahoo8523 Posted September 16, 2020 Share Posted September 16, 2020 For me, I was facing this issue because I was missing the properties file. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now