关于jasperReport问题,把我搞疯了的问题
谁能搞定啊!折磨我2天了!
我用JasperReport在windows环境下调试成功的报表在Linux环境下报错。服务器是websphere应用服务器。客户端java控制台报的错误如下:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream. <init> (Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:140)
at JRPrinterApplet.start(JRPrinterApplet.java:41)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
NESTED BY :
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream. <init> (Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:140)
at JRPrinterApplet.start(JRPrinterApplet.java:41)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
NESTED BY :
net.sf.jasperreports.engine.JRException: Error loading object from URL : http://oa.tjftz.gov.cn:9999/shareentbaseinfosuppportal?dowhat=999&nf=2007&yf=8&ri=1&jnf=2007&jyf=8&jri=30&creatuserid=13919
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:145)
at JRPrinterApplet.start(JRPrinterApplet.java:41)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream. <init> (Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:140)
... 3 more
----------------------------------------------------
客户端代码
<OBJECT codeBase=lib/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0 height=0 width=0 classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93>
<PARAM NAME= "CODE " VALUE= "JRPrinterApplet.class ">
<PARAM NAME= "ARCHIVE " VALUE= " <%=request.getContextPath()%> /printer/printer.jar "> ');
<PARAM NAME= "REPORT_URL " VALUE= " <%=request.getContextPath()%> /shareentbaseinfosuppportal?dowhat=999&nf= <%=nf%> &yf= <%=yf%> &ri= <%=ri%> &jnf= <%=jnf%> &jyf= <%=jyf%> &jri= <%=jri%> &creatuserid= <%=creatid%> ">
</OBJECT>
======================================================
服务器端
JasperPrint jasperPrint = null;
String relativePath = "/report/newreport.jasper "; //报表的相对路径,统一放在WEB应用程序的report路径下
String absolutePath = request.getSession().getServletContext().
getRealPath(relativePath); //绝对路径
BasicDB bdb = new BasicDB();
Connection conn = null;
conn = bdb.getConnection();
try {
jasperPrint = JasperFillManager.fillReport(absolutePath, props,conn);
//JasperRunManager.runReportToHtmlFile(absolutePath,props,new JREmptyDataSource());
ServletOutputStream ouputStream = response.getOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(ouputStream);
oos.writeObject(jasperPrint); //将JasperPrint对象写入对象输出流中
oos.flush();
oos.close();
}
catch (JRException e) {
e.printStackTrace();
}
[解决办法]
<OBJECT codeBase=lib/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0 height=0 width=0 classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93>
这个是windows的注册的部件,在linux下不可用.
[解决办法]
http://www.finereport.com