[英]Report fails on glassfish
我已經使用iReport 5.1.0作了一份報告,並將其部署在Tomcat服務器上,並且工作正常。 但是,當部署在生產服務器(Glassfish 3.1)中時,該報告將永遠不會顯示。 glassfish日志為空,因此未發現任何錯誤。
當我在Eclipse(Glassfish的調試模式)下運行時,執行似乎跳入了
JasperViewer jasperViewer = new JasperViewer(re, false, null);
線。
該消息旁邊是我一直在Tomcat中使用和工作的代碼。
PD原諒我的英語,我是說西班牙語的人。
編碼:
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;
}
驗證生產服務器上是否具有所有jasper庫:它們應位於glassfish / domains / domain1 / lib / ext下。 如果罐子不存在(或其中的一些罐子-如字體或其他一些非必需的lib),您可能會遇到所描述的行為。 還要確保生產機器上的數據庫不為空。 如果沒有要顯示的數據,jasper將顯示一個空白頁。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.