Hi guys,
I just started using the new iReport 3.1.1nb and I must say it is really good !
I just had a major/severe problem with my report, and I am quite disappointed about that...
Here we go :
Error loading the report template
Message:
net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.
Level:
SEVERE
Stack Trace:
org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:80)
com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:485)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
Invalid byte 1 of 1-byte UTF-8 sequence.
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.commons.digester.Digester.parse(Digester.java:1647)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:80)
com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:485)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
It happened at a random time when I opened a specific report after closing iReport for a simple reboot. Since my report XML file is quite big, it is really hard for me to find the wrong code line in all those XML codes.
Please help !
Thank you
Charles M.
19 Answers:
For you information,
The only way I have found to fix the problem is to install the following plugin from the Tools > Plugins menu :
XML and Schema
Version : 1.0.1
By installing this plugin, the version of the IDE changed to 1.2.3.
Is it a common problem from the 1.0.2 IDE version ?
I just ran into the same problem. Saved my report, got out to go to a meeting. Restarted iReport and got the error.
I installed the Plugin XML and Schema as suggested and... I don't get the error but now it sits there saying Loading Report in the Report Inspector.
- Eric
I'm glad it fixed the problem for you guys !!
I find it very hard to troubleshoot that kind of error. I think we must have a debugger tool in the next version of iReport-nb. It is not that bad when the report only has 50 XML lines, but when you have a crosstab and 3 subreports, this is really a pain to fix.
Probably the new NetBeans IDE version has a new version of the SAX Parser, which is handling some more UTF8 sequences.
Theodor, Giulio ? Any idea ?
Thank you guys
Charles M.
emillerphx
Wrote:
OK, unfolding here. I got in there an noticed that my $-signs were showing up as blocks... looking at the pattern some weird character was defined. I changed it to a $ and now everything looks good. |
Yeah I had the same problem. You just need to re-do the pattern operation on your currency field and the $ signs will come back to normal.
Probably the pattern changed in the new IDE.
I confirm that installing the plugin XML and Schema fixed the problem for me. Previously "corrupted" reports can now be loaded in editor.As already said, this installation forces the upgrade of the IDE environment.
In fact my error was "Invalid byte 2 of 3-byte UTF-8 sequence" and not "1 of 1-byte UTF-8 sequence" but I think that the troublr source is the same.
Hi folks,
Hope you are doing fine.
Here is my problem : I work on a report containing a crosstab. That crosstab is populated by a SQL query runned in a dataset. Everything's perfect, but I only have one tiny problem, which is quite annoying. I am unable to hide/remove a full blank line in my crosstab (see the screenshot for more information).
Some will probably say : Why are you adding a blank record in your query results ?
Answer : Well, this is a specific situation. I will try to make it easy to understand. Here we go :
For instance you have a list of laptops in a crosstab. You will need a row group on the serial number, and a column group on the laptops brands.
Let's say you want to list all laptops in a region, for every location/office.
• Office A only has HP and Dell laptops
• Office B only has HP and Lenovo laptops
The problem : You want to show all laptop brands, even if a location doesn't have that laptop brand. (see the second screenshot/image for more information). To achieve it, I add a NULL record in my SQL temp table, representing laptop brands that are missing in the office.
Example : Office A has a NULL record with the Lenovo brand, and Office B has a NULL record with the Dell brand.
This is the only way I found to always print all the columns in the crosstab. Otherwise, the crosstab wasn't showing the NULL columns since it is not available in the SQL query results (raw data).
I just want to hide that null row and eliminate the spacer it creates.
Every field in the crosstab details has Remove Line When Blank checked. As you can see, the line has nothing printed. Now, I just need to hide it for esthetic purpose.
Thank you in advance for help
Charles M.
Gaby38
Wrote:
I confirm that installing the plugin XML and Schema fixed the problem for me. Previously "corrupted" reports can now be loaded in editor.As already said, this installation forces the upgrade of the IDE environment. In fact my error was "Invalid byte 2 of 3-byte UTF-8 sequence" and not "1 of 1-byte UTF-8 sequence" but I think that the troublr source is the same. |
This also solved my problem thankfully!
However instead of installing the "XML and Schema" plugin, you may just install the "IDE Platform" plugin which is ultimately what solves the problem without having to install the extra plugin unless you need / want it. =)
-Scott
Post Edited by Scott Nemes at 01/09/09 20:36
Hello all.
First of all sorry for my english. I'm Spanish and don´t speak english very well.
I'm using iReport nb just for designing the jrxml and then I compile the xml anf create the pdf by java using IBM Websphere and Eclipse IDE.
I have the same problem but I think that the installation of XML and Schema plugin is for NetBeans, isn't it?
Do you have an idea of what is happening?
I've notice that the error appears when i re-open the xml with iReport and save it. If I open then the xml with UltraEdit and directly i save it, the error dissapear.
Thanks a lot.
Hi, I'm using iReport 3.0.0 and using Netbeans 6.5. I've encountered the problem below. The XML and Schema have already installed. May I know what problem do I have? Below are the codes..
net.sf.jasperreports.engine.JRException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
.
.
.
.
.
.
Code: |
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package servlets; import java.io.*; import java.sql.DriverManager; import javax.servlet.*; import javax.servlet.http.*; import java.sql.Connection; //import java.util.HashMap; //import java.util.Map; import net.sf.jasperreports.engine.xml.JRXmlLoader; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.JasperReport; /** * * @author Techprenuer */ public class Report_JobSpecBar extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. * @param request servlet request * @param response servlet response */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO code application logic here Connection connection = null; ServletOutputStream servletOutputStream = response.getOutputStream(); File reportFile = new File(getServletConfig().getServletContext() .getRealPath("/WEB-INF/reports/JobCategorybySpecializationBarChart.jasper")); //Map<String, Object> params = new HashMap<String, Object>(); //params.put("reportTitle", "Company Job Adverts"); //params.put("author", "Melissa"); // params.put("startDate", (new java.util.Date()).toString()); try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager .getConnection("jdbc:mysql://localhost:3306/studentemploymentdb", "root", "dell0208"); //bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), //params, connection); JasperDesign jasperDesign = JRXmlLoader.load(reportFile.getPath()); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, connection); byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint); response.setContentType("text/html"); response.setContentLength(bytes.length); servletOutputStream.write(bytes, 0, bytes.length); servletOutputStream.flush(); servletOutputStream.close(); connection.close(); } catch (Exception e) { // display stack trace in the browser StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); e.printStackTrace(printWriter); response.setContentType("text/plain"); response.getOutputStream().print(stringWriter.toString()); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * @param request servlet request * @param response servlet response */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * @param request servlet request * @param response servlet response */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. */ public String getServletInfo() { return "Short description"; } // </editor-fold> } </td></tr></tbody></table> |
Here is the exception. I hope someone can help me.
net.sf.jasperreports.engine.JRException: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:249)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:228)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:216)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:170)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:154)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:146)
at com.lps.form.JFrameReportTest.<init>(JFrameReportTest.java:40)
at com.lps.form.JFrameReportTest$2.run(JFrameReportTest.java:140)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.arrangeCapacity(XMLEntityScanner.java:1619)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(XMLEntityScanner.java:1657)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:193)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:241)
... 15 more
By Abhishek
Hello ,
I have experianced the same error while runnig reports on Jasperserver.
What I did is to delete those reports from Jasperserver and upload it again,
I know It sound stange but It works for me.
when we try to replace the reports from IReport to Jasper Repository, Specially in the case of the Main Report which contain the reference of subreport. I think this may be the case where reports are not able to replace completely and it cause that error.
Thanks
Abhishek
Post Edited by abhishekverma18 at 09/30/2011 06:11
(i do as what say above and it is work, just remove the Report and add it again, the Report i have, have subReport)
sorry to say that i have not solved the issue.i tried with installing the plugins but the problem remains same.could anyone help me .
I had a similar problem with iReport using xpath queries to an XML file. I changed the file encoding to UTF -8 with Notepad ++ and problem solved .
Yes that is another way to find an issue in the xml...good one!