简体   繁体   中英

Report fails on glassfish

I've made a report using iReport 5.1.0 and deployed on Tomcat server and it works just fine. But when is deployed in production server (Glassfish 3.1), the report never shows up. The glassfish log is empty, so no error was found.

When i run in eclipse (debug mode at Glassfish), the execution seems to jump in

JasperViewer jasperViewer = new JasperViewer(re, false, null);

line.

Next to this message is the code i've been using, and working, in Tomcat.

PD Forgive my english i'm a native spanish speaker.

The code:

public boolean mostrarReporte(String template, Map parametros) {
        JasperReport report = null;
        JasperPrint re = null;
        Connection conn = conexion();
        boolean success = true;

        try {
            String in = FacesUtils.getExternalContext().getRealPath(
                    "/reportTemplates/" + template);
            report = (JasperReport) JRLoader.loadObject(in);

            re = JasperFillManager.fillReport(report, parametros, conn);
            JasperViewer jasperViewer = new JasperViewer(re, false, null);
            // Mostrar el reporte
            jasperViewer.setVisible(true);
            jasperViewer.setDefaultCloseOperation(0);
            parametros.clear();

        } catch (JRException e) {
            success = false;
            e.printStackTrace();
        } finally {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
        return success;
    }

Verify that you have all jasper libraries on your production server : they should be under glassfish/domains/domain1/lib/ext. If the jars are not there (or some of them - like the fonts or some other not mandatory lib), you might experience the behavior you are describing. Also make sure that the database on the production machine is not empty. If there is no data to display, jasper shows an empty page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM