我希望在使用 JasperReports 生成的报告中显示二维码。我正在使用 Jaspersoft Studio (JSS) 6.2.0 生成 jrxml 并使用 iDempiere [ ADEMPIERE_MAIN_VERSION=Release 2.1,ADEMPIERE_DB_VERSION=2014-10-31]。
jrxml 包含此用于显示 QR 码的块:
<componentElement>
<reportElement x="53" y="10" width="99" height="29"/>
<jr:QRCode xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<jr:codeExpression><![CDATA[$F{qrcode}]]></jr:codeExpression>
</jr:QRCode>
</componentElement>
jrxml 在 JSS 中运行良好。现在我已将其附加到发票报告中,并且在从 iDempiere 应用程序的浏览器中打开该报告时,它在 Eclipse 中抛出以下错误。
我还在 Studio 中添加了以下课程。
在 Eclipse 控制台中,我收到以下错误:
Apr 21, 2022 3:43:22 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 1452 column 229: cvc-complex-type.2.4.a: Invalid content was found starting with element 'jr:QRCode'. One of '{"http://jasperreports.sourceforge.net/jasperreports":component}' is expected.
org.xml.sax.SAXParseException; lineNumber: 1452; columnNumber: 229; cvc-complex-type.2.4.a: Invalid content was found starting with element 'jr:QRCode'. One of '{"http://jasperreports.sourceforge.net/jasperreports":component}' is expected.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(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.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1892)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:137)
at org.adempiere.report.jasper.ReportStarter.compileReport(ReportStarter.java:1350)
at org.adempiere.report.jasper.ReportStarter.processReport(ReportStarter.java:1212)
at org.adempiere.report.jasper.ReportStarter.startProcess0(ReportStarter.java:470)
at org.adempiere.report.jasper.ReportStarter.startProcess(ReportStarter.java:345)
at org.adempiere.util.ProcessUtil.startJavaProcess(ProcessUtil.java:172)
at org.compiere.apps.AbstractProcessCtl.startProcess(AbstractProcessCtl.java:466)
at org.compiere.apps.AbstractProcessCtl.run(AbstractProcessCtl.java:272)
at org.adempiere.webui.apps.WProcessCtl.process(WProcessCtl.java:170)
导致此错误的原因以及如何修复?
我在oracle jdev中也遇到了同样的问题。 当我使用旧版本的 ZXing jar 文件(zxing-core 和 zxing-javase-3.3.1 均为 2.2 版)时,问题就解决了