barcode4jdocmosis

Getting barcode4j working with Docmosis Tornado


My requirement is to have a Word.doc file with barcoding embedded, and then turn that into a PDF. I'm trying docmosis for this project, and its worked so far - except when I try to generate the pdf with barcoding enabled. I'm getting the following error, which I'm guessing is a missing dependency, which I'm hoping someone can identify for me.

This is how I'm launching the Docmosis service:

java -jar  docmosisTornado2.3.war -classpath ..\barcode4j-2.1.0\build\barcode4j.jar

and this is the error I'm getting back:

Exception in thread "ODFExplodedTemplatePopulator10987705" java.lang.NoClassDefFoundError: org/krysalis/barcode4j/impl/AbstractBarco
deBean
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.docmosis.template.analysis.barcode.BarcodeGeneratorFactory$_A.A(line:64)
        at com.docmosis.template.analysis.barcode.BarcodeGeneratorFactory$_A.access$0(line:59)
        at com.docmosis.template.analysis.barcode.BarcodeGeneratorFactory.getGenerator(line:39)
        at com.docmosis.template.population.openoffice.PopulationContext.getImage(line:495)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:2590)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.access$1(line:2581)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl$2.A(line:1569)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:1539)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:2781)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:1124)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:481)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:942)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:481)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:1127)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:481)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:1127)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:481)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:516)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:481)
        at com.docmosis.template.population.openoffice.ContentStreamPopulatorObfImpl.A(line:384)
        at com.docmosis.template.population.openoffice.ODFExplodedTemplatePopulator.processContent(line:203)
        at com.docmosis.template.population.openoffice.ODFExplodedTemplatePopulator.processTask(line:113)
        at com.docmosis.util.pipeline.impl.AbstractDataWorker.run(line:129)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.krysalis.barcode4j.impl.AbstractBarcodeBean
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
        ... 26 more

Solution

  • This error shows that the barcode4j classes are not available. For Docmosis-java, add the barcode4j.jar to your classpath. If you are using Docmosis Tornado you'll need to await the next release.

    Docmosis supports barcodes code39, code128 and itf14 based on barcode4j. It's available in the Docmosis Cloud (REST API over the internet) by default and Docmosis-Java (Java API) if you add barcode4j.jar to your class path. Docmosis Tornado (REST API to local web server) is expected to include it from release 2.4.