我正在使用jasper报告在我的Web应用程序中生成报告。该应用程序是一个计费系统。因此,应经常生成报告(清单)。但是问题是应用程序多次生成账单后没有响应。我必须从tomcat应用程序列表中重新启动应用程序。我应该怎么做才能解决这个问题。我使用以下代码生成帐单。
@RequestMapping(value = "/{orderId}/bill/customer")
public void generateCustomerBill(@PathVariable("orderId") Long orderId, HttpServletResponse response) {
//parameters
Map<String, Object> params = new HashMap<>();
params.put("paraOrderId", orderId);
params.put("paraPaidAmount", 0.0);
try {
response.setContentType("text/html");
DataSource dataSource = config.getDataSource();
//load report file
String inputStream = session.getServletContext().getRealPath("/reports/customer_bil_tal.jasper");
JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, params, dataSource.getConnection());
HtmlExporter exporter = new HtmlExporter(DefaultJasperReportsContext.getInstance());
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleHtmlExporterOutput(response.getWriter()));
exporter.exportReport();
} catch (JRException ex) {
Logger.getLogger(CustomerBillController.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(CustomerBillController.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(CustomerBillController.class.getName()).log(Level.SEVERE, null, ex);
}
}
答案 0 :(得分:0)
检查您的方法是否已退出,它可能会锁定某些资源。