I'm trying to display my reports on the browser , but I keep getting this error:
the strange thing about this, is that it only happens when I attempt to generate the reports from the version installed on the server, but not when I do it locally from my pc
Have you any idea why this is happening ?
For those still running into this issue: on Ubuntu Server 12.04 with headless OpenJDK JRE, it was simply solved by
apt-get install ttf-dejavu-extra
This seems like a Headless mode issue. You need to set the java.awt.headless
property to true
. That can be done using:
static {
System.setProperty("java.awt.headless", "true");
}
Or, by setting the headless property in your tomcat startup command as -Djava.awt.headless=true
Also, you can read more on why this is necessary, you can read about the Headless mode here
For me the issue was regarding a bug in AdoptOpenJDK
: https://github.com/AdoptOpenJDK/openjdk-build/issues/682
I fixed the issue by installing ttf-dejavu
manually in my dockerfile
FROM adoptopenjdk/openjdk8:alpine-jre
# Workaround for wrong font configuration in adoptopenjdk
# https://github.com/AdoptOpenJDK/openjdk-build/issues/682
RUN apk update && apk upgrade \
&& apk add --no-cache ttf-dejavu \
# Install windows fonts as well. Not required..
&& apk add --no-cache msttcorefonts-installer \
&& update-ms-fonts && fc-cache -f
AND by running the application with the flag -Djava.awt.headless=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With