javajasper-reportsnoclassdeffounderrorbatik

Got java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/SAXSVGDocumentFactory when using Interleaved2Of5 Barcode format


I am trying to print a list of barcodes, data for which which will be sent to the JasperReports jrxml in a List of Strings.

I am successful in printing the barcodes using barbeque format, but now I have to change the format of barcode to barcode4j Interleaved2Of5. I have added the following dependencies in my pom.xml:

<dependency>
    <groupId>net.sf.barcode4j</groupId>
    <artifactId>barcode4j</artifactId>
    <version>2.1</version>
</dependency>

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>batik-bridge</artifactId>
    <version>1.11</version>
</dependency>

But still getting the below error while running the code:

java.lang.NoClassDefFoundError: org/apache/batik/dom/svg/SAXSVGDocumentFactory

Can any one tell me if there is any issue with the dependecies added or I need to add any other dependecies?


Solution

  • You can use org.apache.xmlgraphics:batik-svg-dom:1.7 artifact to fix this issue.

    As you can see the class is here:

    The content of package

    Notes

    BTW, you can use findjar.com to find jar or class you need. You can check this url to get information where you can find org.apache.batik.dom.svg.SAXSVGDocumentFactory class.

    enter image description here