Pentaho/POI throws InvocationTargetException

Solved by doing 2 things ( implemented using docker ) :

  1. add configuration variables :

    this is needed to let JDK know where is the location of libfontconfig.so

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/:/usr/lib64/"

  1. add default files to JDK/lib folder:

    This is needed because openjdk does not have it by default. the below files are coming from Oracle JDK8

ADD ./src/main/resources/fontconfig.bfc /opt/jdk11/jdk-11.0.1/lib/fontconfig.bfc

ADD ./src/main/resources/fontconfig.properties.src /opt/jdk11/jdk-11.0.1/lib/fontconfig.properties.src

ADD ./src/main/resources/fonts /opt/jdk11/jdk-11.0.1/lib/fonts

Update : the above solution works, but sometimes after the redhat linux loaded, it seems not able to find the font and giving the "java.lang.ClassCastException: class sun.font.CompositeFont cannot be cast to class sun.font.PhysicalFont (sun.font.CompositeFont and sun.font.PhysicalFont are in module java.desktop of loader 'bootstrap')". After 10-30 mins, the issue disappears.

Solution for this :

  1. Adding extra TTF files ( for me it was calibri.ttf ) and copied to /usr/share/fonts/TTF

  2. execute this command : fc-cache -fv This to ensure the font loaded immediately by the fontconfig.

ADD ./src/main/resources/fonts/*.ttf /usr/share/fonts/TTF/
RUN fc-cache -fv