Jump to content
We've recently updated our Privacy Statement, available here ×

Alesque

Members
  • Posts

    2
  • Joined

  • Last visited

Alesque's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. 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: // ClassLoader ClassLoader cl = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { templatePath.toURL() }, cl); // Parameters Map 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_BUNDLE like 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.
×
×
  • Create New...