I know there are a lot of similar questions, but I didn't find exact my case
I have:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.17.0</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.17.0</version>
</dependency>
net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.myfamily=fonts/myfamily.xml
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="Tahoma">
<normal><![CDATA[fonts/Tahoma/tahoma.ttf]]></normal>
<pdfEncoding><![CDATA[Cp1251]]></pdfEncoding>
<pdfEmbedded><![CDATA[true]]></pdfEmbedded>
<exportFonts/>
<locales>
<locale><![CDATA[ru_RU]]></locale>
</locales>
</fontFamily>
</fontFamilies>
AND EVERYTHING WORKS FINE ! WHEN STARTING LOCALLY WITH ADOPT-OPENJDK-15 (sorry for uppercase)
Problems starting when starting on a server, where in docker my application starts in openjdk:15-alpine, there just some fonts included by default https://wiki.alpinelinux.org/wiki/Fonts
and i'm getting an two errors when hitting first time:
java.lang.UnsatisfiedLinkError: /opt/openjdk-15/lib/libfontmanager.so: Error loading shared library libfreetype.so.6: No such file or directory (needed by /opt/openjdk-15/lib/libfontmanager.so)
and when hitting second time (and so on the following error everytime) It's interesting why always first tine comes one error but second and other times another error
java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser] with root cause
I tried some solutions
-Djava.awt.headless=true
RUN apk update && apk upgrade \
&& apk add --no-cache ttf-dejavu
THAT WORKED FOR ME!!! (but not my case, because I don't want to add other dependecies, it could cause more problems with deploying my app on servers)
Switch to another jdk (not alpine) worked, but also not my case, because I have to use alpine version
Switch pdf encoding to
<pdfEncoding><![CDATA[Identity-H]]></pdfEncoding>
with
net.sf.jasperreports.default.font.name=Tahoma
net.sf.jasperreports.default.pdf.font.name=Tahoma
net.sf.jasperreports.default.pdf.encoding=Cp1252
net.sf.jasperreports.default.pdf.embedded=false
here I've got another NPE error, googled about it, and just found an answer to get away from that default properties, no one worked it out
So how to deal with those errors in ALPINE JDK ?
Actually there was no way without installing some font packages as Alex K has mentioned above.
I eventually figure it out when created empty Jasper template without any text, any forms, any fonts. And the same problem had been appeared.
And I had to move from Jasper to iText library, because for me was more important to keep jdk alpine version due to ci/cd and deployment settings