我在做报表时,程序总是抛出例外,提示:net.sf.jasperreports.engine.JRException: Error loading object from file : E:\workspace3\HaierNyAbs\WebContent\ReportFile\customReport.jasper
但是那个文件明明是存在的,而且并没有抛出文件不存在的例外
请各位高手指教一下,到底可能由什么原因导致的,谢谢了:~~代码如下:File jasperReport= new File(req.getRealPath("ReportFile/customReport.jasper"));
if (!jasperReport.exists())
throw new JRRuntimeException("File customReport.jasper not found.");try{
//ctmList是一个list
bytes =
JasperRunManager.runReportToPdf(jasperReport,parameters,new JRBeanCollectionDataSource(ctmList));
}catch(JRException e)
{
System.out.println(e);
}
resp.setContentType("application/pdf");
resp.setContentLength(bytes.length);
ServletOutputStream ouputStream = resp.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
但是那个文件明明是存在的,而且并没有抛出文件不存在的例外
请各位高手指教一下,到底可能由什么原因导致的,谢谢了:~~代码如下:File jasperReport= new File(req.getRealPath("ReportFile/customReport.jasper"));
if (!jasperReport.exists())
throw new JRRuntimeException("File customReport.jasper not found.");try{
//ctmList是一个list
bytes =
JasperRunManager.runReportToPdf(jasperReport,parameters,new JRBeanCollectionDataSource(ctmList));
}catch(JRException e)
{
System.out.println(e);
}
resp.setContentType("application/pdf");
resp.setContentLength(bytes.length);
ServletOutputStream ouputStream = resp.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
解决方案 »
- nasl解析 (java语言)
- 一个很简单的jsp的例子,调试程序报出如下错误信息?帮忙看看是怎么了?
- 如何从方法中引用值
- 自己写对话框
- 怎样监测用户在浏览器中的行为?
- 请教:如何利用optimizeit检测servlet/jsp内存泄漏?
- 关于Swing~~?
- 大家帮帮忙吧,classpath里设置好了jar路径,可程序就是说找不到包!!!
- 我用的是Borland JBuilder 9 Enterprise Trial,请问这个Trial版和正式版有什么区别吗?如果有的话,那儿可以下的没有这个Trial的?谢谢
- 关于"另存为"的问题,请各位高手关心一下小弟,谢谢!
- SQL Server 7 Driver for JDBC
- 查找网页上image项目的正则表达式如何写?
try{
System.out.println("in try block 1 ~");
bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, new JRBeanCollectionDataSource(ctmList));
System.out.println("in try block 2 ~");
}catch(JRException e){
System.out.println(e);
}结果只打印了第一句,没有打印第二句,而且没有抛出JRException