以下是报告生成代码:
JREmptyDataSource dataSource = new JREmptyDataSource();
JasperReport jasperReport = JasperCompileManager.compileReport(sourceFileName);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, param, dataSource);
JasperViewer viewer = new JasperViewer(jasperPrint,false);
viewer.setVisible(true)``
它抛出异常:
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:297)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:276)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:265)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:210)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:185)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:176)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:172)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:459)