Getting an ExceptionInInitializerError on JREBaseFiller

Hi all,

I've developed a java application to create a pdf report. My app works fine on my local machine (Windows 7) but when I launch on a remote server(Windows Server 2008 R2 standard) i receive an absurde exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
        at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(
        at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(
        at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(
        at net.sf.jasperreports.engine.fill.JRFiller.fill(
        at net.sf.jasperreports.engine.JasperFillManager.fill(
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(
        at com.test.PdfWriter.writePdfFromList(
Exception: net.sf.jasperreports.engine.JRRuntimeException thrown from the Uncaug
htExceptionHandler in thread "main"

I'm using jasper reports 6.2.2 and jdk 1.7.25.

This is the method I've devoloped to write the pdf:

   public static void writePdfFromList(final LoggingSettings loggingSettings,
            final List<Object> listToWrite,
            final String jasperDataSourceParamName, final String jasperFile,
            final String pdfOutputFile) throws CustomException {
        LogManagement lm = new LogManagement(loggingSettings, CLASS_NAME);
        try {
            /* Convert List to JRBeanCollectionDataSource */
            lm.debug(new StringBuilder("Defining JRBeanCollectionDataSource")
                    .append(" that will store the array list"));
            JRBeanCollectionDataSource itemsJRBean =
                    new JRBeanCollectionDataSource(listToWrite, false);
            /* Map to hold Jasper report Parameters */
            lm.debug(new StringBuilder("Defining map to hold")
                    .append(" Jasper report Parameters"));
            Map<String, Object> parameters = new HashMap<String, Object>();
            parameters.put(jasperDataSourceParamName, itemsJRBean);
             * Using compiled version(.jasper) of Jasper report to generate
             * PDF
            lm.debug(new StringBuilder("Getting JasperPrint")
            .append(" to the fill report"));
            JasperPrint jasperPrint =
                    JasperFillManager.fillReport(jasperFile, parameters,
                            new JREmptyDataSource());
            /* outputStream to create PDF */
            lm.debug(new StringBuilder("Defining the outputStream")
            .append(" to create PDF"));
            OutputStream outputStream =
                    new FileOutputStream(new File(pdfOutputFile));
            /* Write content to PDF file */
   StringBuilder("Write content to PDF file"));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            throw lm.error(e);

Searching on the web and on the community I found other topics that talks about using jasper javaflow.
I've tried to use the jasper report javaflow but nothing is changed, I still receive same error.

I'm going crazy because I'm not able to understand what is the problem, on my local machine it works, why it doesn't works on the remote server??
Colud you please someone help me or give me some suggestion on how I can solve it??

Thanks in advance

claudio.simonetti's picture
Joined: Mar 30 2016 - 7:52am
Last seen: 7 years 5 days ago

Update: I've just discovered that it works if I launch my app from eclipse but when i build tha jar (with maven) it doesn't work neither on my pc.

What ma i doing wrong?

claudio.simonetti - 7 years 6 days ago

4 Answers:

One thing that you can try is to enable AWT headless mode on the server machine by adding -Djava.awt.headless=true to the Java arguments.

If that doesn't get rid of the error, try getting the latest 6.3.0 snapshot from and test your application with that.  The error might still occur, but at least it should log the original exception (which is currently obscured).



lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 18 hours 21 min ago

Hi Lucian

I think I've finally found the error, it was related to maven. In my project I've the jasper report library and also a jar with some custom fonts (created with jasper studio).

Both jar have the same file. When the maven shade plugin builds the final jar overwrites one of the two properties file, the most important, the one inside the jasper report library. So probably when I launch the app, jasper finds the properties file but at the inside there aren't the propeties he needs to work correctly and this generates that uncaught exception.

I solved it by adding this configuration inside the maven shade plugin:


This tranformer appends the content of one properties file to the other one.

I don't know, if in the future it can be helpful add in the jasper report library the exception to handle when some porperties are missing.

Thanks for the help.

claudio.simonetti's picture
Joined: Mar 30 2016 - 7:52am
Last seen: 7 years 5 days ago

I had a same problem when using customized fonts. In my case, I ended up by adding my fonts to jasperreports-fonts.jar file. Great to find the real cause of the problem.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 11 months ago

Log a bug in the trackers if you think JR should better handle the specific error scenario.  A test case would help, I tried running JR without its and I didn't get the error that you got.

lucianc's picture
Joined: Jul 17 2006 - 1:10am
Last seen: 18 hours 21 min ago