Uploaded image for project: 'mod-template-engine'
  1. mod-template-engine
  2. MODTEMPENG-57

Can't process templates with barcode images

    XMLWordPrintable

    Details

    • Template:
    • Sprint:
      EPAM-Veg Sprint 100, EPAM-Veg Sprint 101, EPAM-Veg Sprint 102
    • Story Points:
      2
    • Development Team:
      Vega
    • Release:
      Q3 2020 Bug Fix

      Description

      Whenever a template contains tokens item.barcodeImage or user.barcodeImage, its processing fails with an exception:

      ERROR TemplateEngineHelper [] no fontmanager in java.library.path: [/usr/lib/jvm/java-11-openjdk/lib/server, /usr/lib/jvm/java-11-openjdk/lib, /usr/lib/jvm/java-11-openjdk/../lib, /usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
      java.lang.UnsatisfiedLinkError: no fontmanager in java.library.path: [/usr/lib/jvm/java-11-openjdk/lib/server, /usr/lib/jvm/java-11-openjdk/lib, /usr/lib/jvm/java-11-openjdk/../lib, /usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
              at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670) ~[?:?]
              at java.lang.Runtime.loadLibrary0(Runtime.java:830) ~[?:?]
              at java.lang.System.loadLibrary(System.java:1870) ~[?:?]
              at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:57) ~[?:?]
              at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
              at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32) ~[?:?]
              at sun.font.SunFontManager$1.run(SunFontManager.java:270) ~[?:?]
              at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
              at sun.font.SunFontManager.<clinit>(SunFontManager.java:266) ~[?:?]
              at java.lang.Class.forName0(Native Method) ~[?:?]
              at java.lang.Class.forName(Class.java:398) ~[?:?]
              at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:82) ~[?:?]
              at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
              at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) ~[?:?]
              at java.awt.Font.getFont2D(Font.java:497) ~[?:?]
              at java.awt.Font$FontAccessImpl.getFont2D(Font.java:237) ~[?:?]
              at sun.font.FontUtilities.getFont2D(FontUtilities.java:139) ~[?:?]
              at sun.font.StandardGlyphVector.initFontData(StandardGlyphVector.java:1132) ~[?:?]
              at sun.font.StandardGlyphVector.init(StandardGlyphVector.java:1121) ~[?:?]
              at sun.font.StandardGlyphVector.<init>(StandardGlyphVector.java:163) ~[?:?]
              at java.awt.Font.createGlyphVector(Font.java:2715) ~[?:?]
              at org.krysalis.barcode4j.output.java2d.Java2DCanvasProvider.deviceText(Java2DCanvasProvider.java:134) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider.deviceText(BitmapCanvasProvider.java:114) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.output.Canvas.drawText(Canvas.java:144) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.DrawingUtil.drawText(DrawingUtil.java:93) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.DefaultCanvasLogicHandler.endBarcode(DefaultCanvasLogicHandler.java:109) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.code128.Code128LogicImpl.generateBarcodeLogic(Code128LogicImpl.java:306) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.code128.Code128Bean.generateBarcode(Code128Bean.java:88) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBarcodeImage(BarcodeImageGenerator.java:34) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBarcodeImageBytes(BarcodeImageGenerator.java:40) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBase64Image(BarcodeImageGenerator.java:55) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.TemplateContextPreProcessor.createAttachment(TemplateContextPreProcessor.java:144) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.TemplateContextPreProcessor.lambda$handleBarcodeImageTokens$8(TemplateContextPreProcessor.java:89) ~[mod-template-engine-fat.jar:?]
      
      ERROR TemplateEngineHelper [] Could not initialize class sun.awt.X11FontManager
      java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
              at java.lang.Class.forName0(Native Method) ~[?:?]
              at java.lang.Class.forName(Class.java:398) ~[?:?]
              at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:82) ~[?:?]
              at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
              at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) ~[?:?]
              at java.awt.Font.getFont2D(Font.java:497) ~[?:?]
              at java.awt.Font$FontAccessImpl.getFont2D(Font.java:237) ~[?:?]
              at sun.font.FontUtilities.getFont2D(FontUtilities.java:139) ~[?:?]
              at sun.font.StandardGlyphVector.initFontData(StandardGlyphVector.java:1132) ~[?:?]
              at sun.font.StandardGlyphVector.init(StandardGlyphVector.java:1121) ~[?:?]
              at sun.font.StandardGlyphVector.<init>(StandardGlyphVector.java:163) ~[?:?]
              at java.awt.Font.createGlyphVector(Font.java:2715) ~[?:?]
              at org.krysalis.barcode4j.output.java2d.Java2DCanvasProvider.deviceText(Java2DCanvasProvider.java:134) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider.deviceText(BitmapCanvasProvider.java:114) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.output.Canvas.drawText(Canvas.java:144) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.DrawingUtil.drawText(DrawingUtil.java:93) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.DefaultCanvasLogicHandler.endBarcode(DefaultCanvasLogicHandler.java:109) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.code128.Code128LogicImpl.generateBarcodeLogic(Code128LogicImpl.java:306) ~[mod-template-engine-fat.jar:?]
              at org.krysalis.barcode4j.impl.code128.Code128Bean.generateBarcode(Code128Bean.java:88) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBarcodeImage(BarcodeImageGenerator.java:34) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBarcodeImageBytes(BarcodeImageGenerator.java:40) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.BarcodeImageGenerator.generateBase64Image(BarcodeImageGenerator.java:55) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.TemplateContextPreProcessor.createAttachment(TemplateContextPreProcessor.java:144) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.TemplateContextPreProcessor.lambda$handleBarcodeImageTokens$8(TemplateContextPreProcessor.java:89) ~[mod-template-engine-fat.jar:?]
              at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
              at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
              at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
              at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
              at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
              at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
              at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
              at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
              at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
              at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
              at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
              at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
              at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
              at org.folio.template.util.TemplateContextPreProcessor.handleBarcodeImageTokens(TemplateContextPreProcessor.java:83) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.util.TemplateContextPreProcessor.process(TemplateContextPreProcessor.java:62) ~[mod-template-engine-fat.jar:?]
              at org.folio.template.service.TemplateServiceImpl.lambda$processTemplate$6(TemplateServiceImpl.java:123) ~[mod-template-engine-fat.jar:?]
      

      Hint: presumably, this functionality broke after upgrading to Java 11. Libraries required for barcode image generation are missing in Docker image alpine-jre-openjdk11. This exact same problem was already fixed once for Java 8 by adding missing library to the container (see Dockerfile). Apparently, this fix is not sufficient for the new image.

        TestRail: Results

          Attachments

            Activity

              People

              Assignee:
              Illia Dolzhenko Illia Dolzhenko
              Reporter:
              OleksandrVidinieiev Oleksandr Vidinieiev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  TestRail: Runs

                    TestRail: Cases