Unable to add Table of Contents or Page Tree macro in a Confluence Datacenter
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Users are not able to add a Table of Contents Macro or a Page Tree Macro in a Confluence page
Environment
Confluence 8.5
Diagnosis
In the catalina.out
log files, the following errors can be observed:
Exception in thread "http-nio-8090-exec-14" java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75)
at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:248)
at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:266)
at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:871)
at com.atlassian.confluence.tinymceplugin.placeholder.DefaultPlaceholderImageFactory.getFontMetrics(DefaultPlaceholderImageFactory.java:215)
at com.atlassian.confluence.tinymceplugin.placeholder.DefaultPlaceholderImageFactory.getPlaceholderImage(DefaultPlaceholderImageFactory.java:60)
at com.atlassian.confluence.tinymceplugin.placeholder.DefaultPlaceholderImageFactory.getPlaceholderImage(DefaultPlaceholderImageFactory.java:54)
at com.atlassian.confluence.tinymceplugin.placeholder.MacroPlaceholderServlet.getPlaceholderImage(MacroPlaceholderServlet.java:117)
at com.atlassian.confluence.tinymceplugin.placeholder.MacroPlaceholderServlet.doGet(MacroPlaceholderServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:529)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:623)
. . .
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:85)
... 375 more
Caused by: java.lang.NullPointerException: Cannot load from short array because "sun.awt.FontConfiguration.head" is null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
Cause
Atlassian installer has a script which will attempt to install the required font configuration package in the most common Linux distributions, however if your Linux distribution is not covered by our script, and does not include a suitable font configuration package, you will need to install one manually.
Solution
To tackle this problem, a fontconfig (or an equivalent library) should be installed prior Confluence installation. Refer to the documentation for your Linux distribution or preferred package manager for further information about how to do this.
Here are the commands to install font dependency in a number of common Linux distributions and package managers:
Installing the below packages may need a restart of your Confluence instance
Ubuntu
To install the fontconfig
package on Ubuntu 18:
sudo apt install -y fontconfig
CentOS
CentOS 7 does not work with fontconfig
. You can install dejavu-sans-fonts
as an alternative:
sudo yum install -y dejavu-sans-fonts
RHEL
To install fontconfig
on RedHat Enterprise Linux 7.5:
sudo yum install fontconfig
On RHEL 6, it might be necessary to install both the dejavu-sans-fonts
and the fontconfig
packages:
sudo yum install -y dejavu-sans-fonts
Debian
To install the fontconfig
package on Debian 9.5:
apt-get update && apt-get install -y fontconfig
Fedora
To install the fontconfig
package on Fedora 28:
dnf install -y fontconfig