Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2006, 06:49 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please reply me urgently!

hello!
I want to display the report named "dailyAttendanceReport" which have two subreports "dailyAttendanceSubReport.jasper" and "dailyAttendanceSubReportCout.jasper".
"Generatedaily.jsp" the code i implemented as following:
==========================================
<%@ page errorPage="error.jsp" %>
<%@ page import="net.sf.jasperreports.engine.*" %>
<%@ page import="net.sf.jasperreports.engine.util.*" %>
<%@ page import="net.sf.jasperreports.engine.export.*" %>
<%@ page import="net.sf.jasperreports.engine.JasperReport" %>
<%@ page import="net.sf.jasperreports.engine.JRException" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.awt.Image" %>
<%@ page import="java.lang.Object" %>
<!-- <%@ page import="java.io.InputStream" %>
<%@ page import="java.io.UTFDataFormatException" %>
<%@ page import="javax.servlet.http.HttpServletResponse" %>-->
<!--
<%
JRProperties.setProperty(
JRProperties.COMPILER_CLASSPATH,
application.getRealPath("/WEB-INF/lib/jasperreports-1.0.1.jar") +
System.getProperty("path.separator") +
application.getRealPath("Jsp/WEB-INF/classes/")
);

JRProperties.setProperty(
JRProperties.COMPILER_TEMP_DIR,
application.getRealPath("Jsp/edb-jasperreports-2.0/")
);

JasperCompileManager.compileReportToFile(applicati on.getRealPath("Jsp/edb-jasperreports-2.0/DailyAttendanceSubReport.jrxml"));
%>
-->
<% String AttendanceDate = request.getParameter("AttendanceDate");

File reportFile = new

File(application.getRealPath("Jsp/edb-jasperreports-2.0/DailyAttendance.jasper"));

File dasr = new File(application.getRealPath("Jsp/edb-jasperreports-2.0/DailyAttendanceSubReport.jasper"));
JasperReport report = JasperCompileManager.compileReport( reportFile.getPath() );
JasperReport jasperReport = (JasperReport)JRLoader.loadObjectFromLocation(repo rtFile.getPath());
JasperReport subreport = JasperCompileManager.compileReport(dasr.getPath()) ;
JasperReport jasperReport1 = (JasperReport)JRLoader.loadObjectFromLocation(dasr .getPath());



if (!reportFile.exists()||!dasr.exists())
throw new JRRuntimeException("File DailyAttendance.jasper not found. The report design must be compiled first.");


Map parameters = new HashMap();
parameters.put("DailyAttendanceSubReport", subreport);
parameters.put("DailyAttendance", report);
parameters.put("AttendanceDate",AttendanceDate);
//response.setContentLength(bytes.length);
//creates an jdbc connection

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection("jdbc:odbc:Edbtms");
JasperPrint jasperPrint =
JasperFillManager.fillReport(
jasperReport,
parameters,
con
);


StringBuffer sbuffer = new StringBuffer();

JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_P RINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_W RITER, out);
exporter.setParameter(JRHtmlExporterParameter.IS_U SING_IMAGES_TO_ALIGN, Boolean.FALSE);
exporter.exportReport();
%>

===============================================
but the sever has encountered the following issue:

JasperReports encountered this error :
java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
at org.apache.xerces.impl.io.UTF8Reader.invalidByte(U nknown Source)
at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unkno wn Source)
at org.apache.xerces.impl.XMLEntityScanner.skipString (Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determin eDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
at org.apache.commons.digester.Digester.parse(Digeste r.java:1647)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:236)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:223)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:211)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:165)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:149)
at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:142)
at org.apache.jsp.Jsp.GenerateDaily_jsp._jspService(G enerateDaily_jsp.java:96)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

NESTED BY :
net.sf.jasperreports.engine.JRException: Invalid byte 1 of 1-byte UTF-8 sequence.
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:244)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:223)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:211)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:165)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:149)
at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:142)
at org.apache.jsp.Jsp.GenerateDaily_jsp._jspService(G enerateDaily_jsp.java:96)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.io.UTFDataFormatException: Invalid byte 1 of 1-byte UTF-8 sequence.
at org.apache.xerces.impl.io.UTF8Reader.invalidByte(U nknown Source)
at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
at org.apache.xerces.impl.XMLEntityScanner.load(Unkno wn Source)
at org.apache.xerces.impl.XMLEntityScanner.skipString (Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determin eDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
at org.apache.commons.digester.Digester.parse(Digeste r.java:1647)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:236)
... 36 more

Please if someone wants to solve my problem urgently i would very much thankful to him/her.
Best regards!


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgently Need Help humayoo Beginning PHP 2 October 16th, 2007 02:39 PM
Need Help Urgently dpkbahuguna Beginning VB 6 2 August 10th, 2006 01:29 AM
urgently need help sumeghagupta .NET Web Services 1 October 5th, 2004 11:38 PM
Urgently need help... scott Access 23 October 18th, 2003 09:40 PM



All times are GMT -4. The time now is 04:46 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.