Solved

JasperFillManager fails to create output

Posted on 2015-02-24
6
25 Views
Last Modified: 2016-07-19
I'm trying to upgrade from Jasper Reports 5.5.1 to 6.0 but I can't get any output.  I'm running a standalone java application using compiled jrxml files.

I'm pretty sure it's a library I'm missing but I've gone through the documentation and I have all of the required libraries, so I'm not sure how to troubleshoot this further.

Also the program (at least in netbeans) runs through code in an unexpected fashion that I also can't figure out.

First here are the libraries that are included in the project.
List of librariesHere is the sample code where it fails.
    public static JasperPrint fillReport(String filename, JRParDataSource jrds,
            HashMap<String, Object> parameters) throws JRException {

     JasperPrint jasperPrint = null;
     jasperPrint = JasperFillManager.fillReport(filename, parameters,
                        jrds);
       return jasperPrint;
    }

Open in new window

The program runs the fillReport line but never hits the return jasperPrint line.

Here is the calling routine

    public static void saveJasperPrint(String jasperPath, String jasperFilename,
            String filename, HashMap<String, Object> parameters, JRParDataSource jrds)
            throws JRException {
        jasperPath = FileEx.makePathname(jasperPath, jasperFilename, true);
        jasperPath += ".jasper";

        // create jasperPrint
        JasperPrint jasperPrint = null;
        jasperPrint = fillReport(jasperPath, jrds, parameters);
        // save report
        saveReport(jasperPrint, new File(filename));
    }

Open in new window


After calling fillReport it never returns to run saveReport

And finally the top level caller.
try {   //other code in here
    setProgress(0);
    for (nDone=0; nDone< nTotal; nDone++) {  
             try {
                    // Add current user id to filename to prevent getting
                    // mixed up with someone else's report.
                        ReportFileIO.saveJasperPrint(criteria.getReportType().filename,
                            criteria.getFilename() + "." + user, parameters, jrds);
                } catch (JRException e) {
                    errors.add(BusinessConstants.dataCentreName + ": Unable to create jasperPrint for " +
                            criteria.getFilename());
                    break;
                }
            }
       }
        catch (Exception e) {
            errors.add(e.getMessage() + "\n" + Trace.printTrace(e));
        } finally {
            setProgress(100);
            return errors.isEmpty() ? null : errors;
        }

Open in new window


The call to saveJasperPrint happens and the return goes directly to the finally statement without being caught in any of the exception handlers.  

So I'm not sure how to resolve this problem.
0
Comment
Question by:geekdad1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 16

Expert Comment

by:krakatoa
ID: 40628971
The program runs the fillReport line but never hits the return jasperPrint line.

How do you know that?
0
 
LVL 1

Author Comment

by:geekdad1
ID: 40629249
Running in debug mode under netbeans 7.0  I reach the breakpoint at  fillReport but single stepping from that statement goes right to the finally statement in the top level calling program.
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 40629368
Well from what I see of the API for this, the JasperFillManager.fillReport() methods with 3 args seem to take the Map params as the last argument - maybe you want to check this, iianm. But I could be wrong as I don't do Jasper.
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Author Comment

by:geekdad1
ID: 40629518
This is a working application (at least it was until I tried to upgrade jasper), so I'm quite sure the arguments to the function are fine.
0
 
LVL 1

Accepted Solution

by:
geekdad1 earned 0 total points
ID: 41711411
Closing this as it's too old.
0
 
LVL 1

Author Closing Comment

by:geekdad1
ID: 41718751
Moved on to other problems.  No longer an issue
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 158
ejb entity bean example 2 55
DTD and JAVA versions 1 54
Setup Eclipse for Andriod development 2 17
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question