When using RHEL 7.4, and viewing a captcha, or when navigating to Control Panel > Configuration > Server Administration, the following stack trace will appear in the application server logs. That is catalina.out for Tomcat.
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:75)
at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
at sun.font.FontDesignMetrics.initMatrixAndMetrics(FontDesignMetrics.java:359)
at sun.font.FontDesignMetrics.<init>(FontDesignMetrics.java:350)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:302)
at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:855)
at org.jfree.text.G2TextMeasurer.getStringWidth(G2TextMeasurer.java:79)
at org.jfree.text.TextUtilities.nextLineBreak(TextUtilities.java:294)
at org.jfree.text.TextUtilities.createTextBlock(TextUtilities.java:235)
at org.jfree.chart.title.TextTitle.arrangeRR(TextTitle.java:632)
at org.jfree.chart.title.TextTitle.arrange(TextTitle.java:501)
at org.jfree.chart.JFreeChart.drawTitle(JFreeChart.java:1321)
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1209)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1409)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1389)
at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:183)
at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:136)
at com.liferay.server.admin.web.internal.portlet.action.ViewChartMVCResourceCommand.doServeResource(ViewChartMVCResourceCommand.java:108)
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCResourceCommand.serveResource(BaseMVCResourceCommand.java:41)
... 168 more
You may also encounter this stack trace result when using related operating systems, such as Fedora or CentOS.
The issue occurs because of issues with OpenJDK 1.8.0.141-2 in Red Hat 7.4 and its default font package, Stix. See the following links for reference.
- Why AWT based application fails when stix fonts is in use?
- Upgrade RHEL from 7.3 to 7.4: ArrayIndexOutOfBoundsException in sun.font.CompositeStrike.getStrikeForSlot
- Bug 1479563 - Exception using stix-fonts with openjdk
- Bug 1484079 - AWT java apps fail to start when stix-fonts is used as sans-serif font
Resolution
There are two known resolutions and one workaround:
- Revert the Stix font back to Utopia fonts
- Update to an OpenJDK version newer than 1.8.0.141-2
Workaround:
- In some scenarios installing dejavu fonts fixes the problem:
yum install dejavu-serif-fonts yum install dejavu-sans-fonts yum install dejavu-fonts-common