Open timja opened 5 years ago
Are you sure you're setting the system property correctly? How can you tell?
Yes I'm sure : here is the log produces by my Tomcat instance
2019-10-11 07:50:40,266 (UTC) - [main] INFO org.apache.catalina.startup.VersionLoggerListener:115 - Command line argument: -Djava.awt.headless=true
Please try this without Tomcat to eliminate a potential source of problems here. /path/to/adoptopenjdk/java -Djava.awt.headless=true -jar /path/to/jenkins.war and nothing else.
There is no problem without Tomcat : the provided command works almost well.
Despite of this, we don't use the same code to launch the webapp with or without Tomcat :
At this point the problem can be caused by two things (or maybe others I couldn't imagine) :
Moreover, I did a heapdump (when using the Tomcat instance). In this file we can see the system properties.
java.awt.headless appears among them.
Thanks to it, we can tell that Tomcat is not the problem : it doesn't alter the system properties.
I think the static code should be reviewed.
May be this helps as work-around:
On Linux systems, the fontconfig.x86_64 package should be installed to avoid a NullPointerException error when the AWT font subsystem is initialized. Work is ongoing at the AdoptOpenJDK project to fix this issue for their OpenJDK binaries.
(https://www.eclipse.org/openj9/docs/adoptopenjdk/)
Thank you sao_die , you save my date. By installing the fontconfig.x86_64, the error is gone.
Hello
Just to inform I have the same situation at:
In my case for Ubuntu Server 18:04, so the proposed solution was with fontconfig (it because fontconfig.x86_64 does not exist)
Therefore
sudo apt install fontconfig
was used. Working with
java -version openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
Huge thanks for the solution and a well deserved cold beer for Sascha Dierkes - it is the unique place where the proposed solution works.
I shared it in details on StackOverflow.
I tried to use AdoptOpenJDK jdk8u222-b10 instead of Oracle JDK 8.
I need to change my JDK, that's not my choice, and I couldn't launch Jenkins because of this issue :
When I rollback to use the Oracle JDK, everything is fine.
The problem seems to be the static initialisation bloc inside hudson.util.ChartUtil :
With such code, AWT is referenced even with -Djava.awt.headless=true, because it is static.
Originally reported by jbreda, imported from: AWT initialized even with -Djava.awt.headless=true