LaVOZs

The World’s Largest Online Community for Developers

'; Barcode creation in Jasper report: n is not a valid character for Standard 2 of 5 encoding - LavOzs.Com

Got the below error while i'm trying to create Barcode using Ireport 1.2.3

Error filling print...

java.lang.RuntimeException: n is not a valid character for Standard 2 of 5 encoding     at it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(BcImage.java:73)     at PrintIDCardreport_1452662388727_145783.evaluate(PrintIDCardreport_1452662388727_145783:198)     at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:172)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:556)     at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:524)     at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:952)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:420)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:403)     at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275)     at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1289)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:666)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:517)     at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:680)     at java.lang.Thread.run(Unknown Source)

Code for barcode creation:

<image  scaleImage="FillFrame" vAlign="Middle" hAlign="Center" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
    <reportElement
        mode="Opaque"
        x="32"
        y="123"
        width="50"
        height="10"
        forecolor="#000000"
        backcolor="#FFFFFF"
        key="barcode-1"/>
        <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
        <graphicElement stretchType="NoStretch" pen="None" fill="Solid" />
<imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(13,$F{subjectno1},false,false,null,0,0)]]></imageExpression>
</image>

Used jar files: barbecue-1.1.jar, ireport.jar.

I can able print barcode for static barcode expression.

See the value of $F{subjectno1} variable for letters.

As stated here 2 of 5 barcode standard is only for encoding digits. If You must have letters in it, check code 128 standard instead.

Related
How to solve this nullPointer Exception in jasper report?
iReport font not available to JVM net.sf.jasperreports.awt.ignore.missing.font=true has no effect.
Jasper sub report error
Jasper reports: getting errors of class not found
Jasper Reports Breaks on Build (no edits)
Jasper reports List as Parameter
JasperReport: How to get date from the "oracle.sql.TIMESTAMP' field?
An error has occurred. Please contact your system administrator. (6632) error in Jasper server 6.2