gpt4 book ai didi

java - glassfish 报告失败

转载 作者:行者123 更新时间:2023-11-28 23:39:20 25 4
gpt4 key购买 nike

我已经使用 iReport 5.1.0 制作了一份报告并部署在 Tomcat 服务器上,它工作得很好。但是当部署在生产服务器(Glassfish 3.1)中时,报告永远不会出现。glassfish 日志是空的,所以没有发现错误。

当我在 eclipse 中运行时(Glassfish 的 Debug模式),执行似乎跳入了

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 下。如果 jar 不存在(或其中一些 - 如字体或其他一些非强制性库),您可能会遇到您所描述的行为。还要确保生产机器上的数据库不为空。如果没有数据显示,jasper 显示一个空页面。

关于java - glassfish 报告失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21436446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com