关于IREPORT制作报表的错误,代码运行后台报错,网上查了好多资料,估计是JAR的问题,请教大侠:

<%@ page language="java" pageEncoding="GBK"%>
<%@ page import="net.sf.jasperreports.engine.JasperFillManager" %>
<%@ page import="net.sf.jasperreports.engine.JasperPrint"%>
<%@ page import="net.sf.jasperreports.engine.JRException"%>
<%@ page import="net.sf.jasperreports.engine.JRExporterParameter"%>
<%@ page import="net.sf.jasperreports.engine.export.JRXlsExporterParameter"%>
<%@ page import="net.sf.jasperreports.engine.export.JRXlsExporter"%>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>

<%
//报表所需jasper文件位置
File reportFile = new File(this.getServletContext().getRealPath("carreport.jasper"));
//报表所需要的数据库连接
Connection conn=null;
//报表所需要的参数
Map parameters=null;
String url=reportFile.getPath();
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.207:1521:orcl","zlzsj","gmhs");
JasperPrint jasperPrint = JasperFillManager.fillReport(reportFile.getPath(),null,conn);

response.setContentType("application/vnd.ms-excel" );
String fileName = new String("未命名.xls".getBytes("GBK"), "ISO8859_1");
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
ServletOutputStream ouputStream = response.getOutputStream();
JRXlsExporter exporter = new JRXlsExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,ouputStream);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.FALSE);
exporter.exportReport();
ouputStream.flush();
ouputStream.close();
%>

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: net.sf.jasperreports.engine.JRException: Error loading object from file : D:\workspace\gmhs\WebRoot\carreport.jasper

javax.servet.ServletException: net.sf.jasperreports.engine.JRException: Error loading object from file : D:\workspace\gmhs\WebRoot\carreport.jasper

net.sf.jasperreports.engine.JRException: Error loading object from file : D:\workspace\gmhs\WebRoot\carreport.jasper

java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 10200, local class serialVersionUID = 10002

第1个回答  2013-08-12
我的还郁闷,在我们的机子,很多客户的机子上都没有问题,有一个客户机子上也是报这个错。正在找原因中。
相似回答