0

I want to show on my JasperRepost one EAN13 barcode. I have the 13 digit input in the field list for it (SQL query is also OK), but in JasperSoft Studio 6.6.0 the "Barcode" element in the Palette doesn't seem to work with drag-and-drop (doesn't do anything sadly...). So... I went into the source view and made some Google searches, how the barcode element should look like and found this:

<componentElement>
                <reportElement x="0" y="100" width="200" height="50" uuid="48d9d636-7e04-43df-9fa2-5c3f6edf27da"/>
                <c:barbecue xmlns:c="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" type="EAN13" drawText="true" checksumRequired="false">
                    <c:codeExpression><![CDATA[$F{EAN}]]></c:codeExpression>
                </c:barbecue>
            </componentElement>

But, this also doesn't seem to be okay, because I got this error if I want to preview it:

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:536)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
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:1039)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:469)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:417)
    at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillFixedBand(JRHorizontalFiller.java:2553)
    at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillDetail(JRHorizontalFiller.java:853)
    at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReportStart(JRHorizontalFiller.java:264)
    at net.sf.jasperreports.engine.fill.JRHorizontalFiller.fillReport(JRHorizontalFiller.java:116)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
    at java.lang.Thread.run(Thread.java:748)
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.linear.ean.EAN13Barcode.<init>(Unknown Source)
    at net.sourceforge.barbecue.BarcodeFactory.createEAN13(Unknown Source)
    at net.sf.jasperreports.components.barbecue.BarcodeProviders$EAN13Provider.createBaseBarcode(BarcodeProviders.java:241)
    at net.sf.jasperreports.components.barbecue.BaseBarcodeProvider.createBarcode(BaseBarcodeProvider.java:40)
    at net.sf.jasperreports.components.barbecue.BarcodeProviders.createBarcode(BarcodeProviders.java:110)
    ... 13 more

Wat could be the problem? Invalid data length? My test barcode value is this actually: 6941057402314, exactly 13 digits long. This value is stored in the db as VARCHAR, could this be the problem?

EDIT.:

Ok, I found out that this is maybe a Barbecue issue: Babrbecue Exception but this is 10 years old...

Thank you.

VORiAND
  • 145
  • 3
  • 17
  • 35

1 Answers1

0

As it turned out the EAN13 barcode is actually 12 digits long, the 13th digit is calculated. So if I changed it to 12 digits, the barcode is generated.

VORiAND
  • 145
  • 3
  • 17
  • 35