I've added a UPCA barcode which references a field in the JSON file.
I've got the EAN13 option working, but if the barcode is 12 digits, I'm supposed to use the UPCA option. I've got a print when on each barcode.
I get this error:
Can anyone please help!?
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode. at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:553) at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$18(ReportController.java:528) at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:446) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating barcode. at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:114) at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.setBarcodeImage(BarbecueFillComponent.java:142) at net.sf.jasperreports.components.barbecue.BarbecueFillComponent.fill(BarbecueFillComponent.java:111) at net.sf.jasperreports.engine.fill.JRFillComponentElement.fill(JRFillComponentElement.java:198) at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1040) at net.sf.jasperreports.engine.fill.JRFillFrame.fill(JRFillFrame.java:354) at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1040) at net.sf.jasperreports.engine.fill.JRFillFrame.fill(JRFillFrame.java:354) at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1040) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2615) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:836) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:275) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:119) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:622) at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135) at java.base/java.lang.Thread.run(Unknown Source) Caused by: net.sourceforge.barbecue.BarcodeException: Invalid data length at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source) at net.sourceforge.barbecue.linear.upc.UPCABarcode.<init>(Unknown Source) at net.sourceforge.barbecue.BarcodeFactory.createUPCA(Unknown Source) at net.sf.jasperreports.components.barbecue.BarcodeProviders$UPCAProvider.createBaseBarcode(BarcodeProviders.java:377) at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40) at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110) ... 17 more
1 Answer:
Posted on April 19, 2023 at 10:08pm
The error indicates that the data you are passing has an invalid length. Can you ensure the data you are passing to the barcode matches with the encoding standard? EAN-13 barcode requires 13 digits, UPC-A barcode requires 12 digits. Please provide sample JRXML and Json files if you still continue to face issues.
Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.
Thank you for your patience, we have not forgotten you. We need a little more time with our team of experts to come up with a solution. We will respond back with an answer as quickly as we can.