Jump to content

Barcode4J does not work after migrating to JasperReports v7


thomash
Go to solution Solved by Teodor Danciu - Staff,

Recommended Posts

Hello community,

I recently updated JasperReports and managed to export reports.

Unfortunately I experience this error, when exporting a barcode4j-Report:


 

Quote

 

net.sf.jasperreports.engine.JRRuntimeException: No component manager found for type net.sf.jasperreports.barcode4j.QRCodeComponent.

    at net.sf.jasperreports.engine.component.ComponentsEnvironment.getManager(ComponentsEnvironment.java:143)

    at net.sf.jasperreports.engine.component.ComponentsEnvironment.getManager(ComponentsEnvironment.java:124)

    at net.sf.jasperreports.engine.fill.JRFillComponentElement.<init>(JRFillComponentElement.java:68)

    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitComponentElement(JRFillObjectFactory.java:1049)

    at net.sf.jasperreports.engine.base.JRBaseComponentElement.visit(JRBaseComponentElement.java:76)

    at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:70)

    at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:82)

    at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:92)

    at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:129)

    at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:453)

    at net.sf.jasperreports.engine.fill.JRBaseFiller.createFillBand(JRBaseFiller.java:363)

    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:283)

    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:82)

    at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:252)

    at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:272)

    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:115)

    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:104)

    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:529)

    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:953)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)

    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1387)

    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)

    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)

    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)

    at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)

    at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)

    at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:197)

 

I already added the dependency jasperreports-barcode4j to my pom.xml. 

 

Are there other steps needed?

Link to comment
Share on other sites

  • 2 weeks later...

This issue seems to be related to creating an Uber JAR with the maven-shade-plugin, because the jasperreports_extension.properties will not be merged due to the fact, that the file exists in several projects now.

Adding:

Quote

 

                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>jasperreports_extension.properties</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>metadata_messages-default.properties</resource>
                                </transformer>

 

solved this issue but another one appeared with and without maven-shade-plugin:

Quote

java.lang.NullPointerException: Cannot invoke "net.sf.jasperreports.barcode4j.ErrorCorrectionLevelEnum.getErrorCorrectionLevel()" because the return value of "net.sf.jasperreports.barcode4j.QRCodeBean.getErrorCorrectionLevel()" is null
    at net.sf.jasperreports.barcode4j.QRCodeSVGImageProducer.createImage(QRCodeSVGImageProducer.java:87)
    at net.sf.jasperreports.barcode4j.AbstractBarcodeEvaluator.evaluateBarcodeRenderable(AbstractBarcodeEvaluator.java:124)
    at net.sf.jasperreports.barcode4j.AbstractBarcodeEvaluator.visitQRCode(AbstractBarcodeEvaluator.java:576)
    at net.sf.jasperreports.barcode4j.QRCodeComponent.receive(QRCodeComponent.java:81)
    at net.sf.jasperreports.barcode4j.AbstractBarcodeEvaluator.evaluateBarcode(AbstractBarcodeEvaluator.java:87)
    at net.sf.jasperreports.barcode4j.BarcodeFillComponent.evaluateBarcode(BarcodeFillComponent.java:82)
    at net.sf.jasperreports.barcode4j.BarcodeFillComponent.evaluate(BarcodeFillComponent.java:70)
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:112)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:283)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:530)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:461)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:421)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:119)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:625)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:416)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:121)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:104)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:529)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:953)

Maybe someone encountered this one?

Link to comment
Share on other sites

After setting any errorCorrectionLevel in the Report the report finally works.

 

<element kind="component" uuid="28a4af9a-5de4-45f2-81c2-0545a85f1353" x="280" y="113" width="159" height="114" backcolor="rgba(255, 255, 255, 0.0)">

<component kind="barcode4j:QRCode" errorCorrectionLevel="H">

<codeExpression><![CDATA[$F{NUM_TEST}]]></codeExpression>

</component>

 

However, if you use the Barcode4j-Palette in the Jaspersoft® Studio 7.0.0 - Visual Designer for JasperReports the default setting is, that this parameter is not set in the JRXML. In the designer one can see, that the setting is shown as if the errorCorrectionLevel is set to "L".

image.png.9848382c8a886beee14ce00e0c180548.png

Is this maybe a configuration issue of the palette of the new JasperSoft Studio version?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...