net.sf.jasperreports.engine.JRException:Class not found when loading object from file代码如下用jsp调用(那itext-1.3.1.jar,itextasia.jar等这几个包都导入了,但报以上的异常):      <%
        //报表编译之后生成的.jasper 文件的存放位置
        File reportFile = new File(application.getRealPath("/reports/first.jasper"));
        //这个是用来联接我的mysql 的JDBC URL
Connection conn=null;
    try{
Context ctx=new InitialContext();DataSource source = (DataSource)ctx.lookup("java:comp/env/123");
  conn=source.getConnection();}catch(Exception e){
e.printStackTrace();
}       System.out.println("---------conn-------------");
       //连接到数据库
   
   JasperPrint jasperPrint=JasperFillManager.fillReport(reportFile.getPath(),null,conn);       byte[] bytes=JasperRunManager.runReportToPdf(reportFile.getPath(),null,conn);       System.out.println("---------Jasper end-------------");
       response.setContentType("application/pdf");
       response.setContentLength(bytes.length);
       ServletOutputStream ouputStream = response.getOutputStream();
       ouputStream.write(bytes, 0, bytes.length);
       ouputStream.flush();
       ouputStream.close();
     %>这个问题已婚好多天没有搞定了。。以前是可以出来的。。也是这个程序,但现在不知是怎么回事运行起来报错.大家帮帮忙!
只要问题能解决。。一定送分!

解决方案 »

  1.   

    既然已经报错“Class not found ...”,仔细检查这方面的原因,可尝试重新部署一下。
      

  2.   

    我用输出语句输出查看一下路径:是正确的。但为什么会出现这样的错误。。这个问题我到现在都不能解决。请大家给我正确的方法,如果有程序的话,一起发给我好吧!-----包括Ireport安装文件,包以及程序,感谢,邮箱是[email protected]   谢谢!~
      

  3.   

    错误很明白啊
    找不到要装载的class文件
    你先看一下你目录下有没有要装载的文件
    然后再检查路径吧
    没什么其他问题啊