Alesque Posted December 20, 2007 Share Posted December 20, 2007 Hi, I'm trying to fill a report enclosing images and a resource bundle. Files of those resources are located into a specific folder outside the classpath, so I created a URLClassLoader which is sent via the parameter REPORT_CLASS_LOADER enabling the FillManager to load those files. If I fill a report which only encloses images that works like a charm. But if the report references a resource bundle (i18n purpose), I get an exception telling that the bundle name is not found. It seems that the FillManager doesn't use the classloader given in parameter to load the bundle referenced in the JRXML file. Code:// ClassLoaderClassLoader cl = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { templatePath.toURL() }, cl); // ParametersMap jasperParameters = new HashMap();jasperParameters.put(JRParameter.REPORT_CLASS_LOADER, loader);jasperParameters.put(JRParameter.REPORT_LOCALE, locale); A simple workaround is to set the parameter JRParameter.REPORT_RESOURCE_BUNDLElike this: Code:[code][...]if (jasperReport.getResourceBundle() != null){ jasperParameters.put(JRParameter.REPORT_RESOURCE_BUNDLE, ResourceBundle.getBundle(jasperReport.getResourceBundle(), locale, loader)); } In the case a report references subreport, and the subreport references resource bundle, this workaround won't work. Is this a bug of jasper report? Any help would be appreciated. Link to comment Share on other sites More sharing options...
lucianc Posted December 21, 2007 Share Posted December 21, 2007 The report classloader is indeed not used to load the resource bundle. Please post a bug for this here. Regards,Lucian Link to comment Share on other sites More sharing options...
lucianc Posted January 15, 2008 Share Posted January 15, 2008 Bug artf2917 has been fixed on SVN trunk. Regards,Lucian Link to comment Share on other sites More sharing options...
lorenzalder Posted May 2, 2008 Share Posted May 2, 2008 Hi, could you please tell me if artf2917 is included in the 2.0.5 distribution ? TIA Lorenz Link to comment Share on other sites More sharing options...
lucianc Posted May 2, 2008 Share Posted May 2, 2008 Yes, the fix for artf2917 is included in JR 2.0.5. Regards,Lucian 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