[#10346] - Exception when logging JRRuntimeException

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

I had a severe error situation in a program using jasper reports library for generating a report template depending on some data layout. Because of a failure in my program, a JRRuntimeException was thrown which should have been caught and logged by my code.

Unfortunately, the program crashed completely when the exception has occurred. It took me a while to find out that the logging of the runtime exception was throwing an exception again and therefore no stack trace was printed and available for chasing down the reason.

When I started to debug the code, I found out that the toString() method of the JRRuntimeExcpetion was throwing again a JRRuntimeException because the initial thrown JRRuntimeException has got a message key but no MessageProviderFactory could be found in method MessageUtil#getMessageProvider(...). So one of the intial problems was that the extension properties couldn't be found on the classpath.

I know that the initial problem was self made but I think that in that case the exceptional behavior of the JasperReports library is quite bad. Who is expecting exceptions when logging the exception message or printing the stack trace when an exception is caught? This can break many applications quite easily, I think. I would suggest to catch the RuntimeException in the method JRRuntimeException#resolveMessage(...) similar to the MissingResourceException

protected String resolveMessage(JasperReportsContext jasperReportsContext, Locale locale)
if (messageKey != null)
String bundleName = getMessageBundleName();
MessageProvider messageProvider = MessageUtil.getInstance(jasperReportsContext).getMessageProvider(bundleName);
return messageProvider.getMessage(getMessageKeyPrefix() + messageKey, args, locale);
catch (JRRuntimeException | MissingResourceException e)
return messageKey;

asprom's picture
Joined: Nov 25 2013 - 5:31am
Last seen: 1 year 11 months ago


  • Status:New» Acknowledged

I run into this just now. Want to load a report from a JRXML but JR crashes when I try this from a custom JRE image (JDK 14). I guess my custom image is missing some dependencies, but this bug makes it really hard to figure out.