Issue with rendering charts - Openhab 3.1 - Synology Diskstation

All-

I just migrated from OpenHAB 2.5 to OpenHAB 3.1 on a Synology DiskStation 218+ running DSM 6.2. I installed the Azul Java 11 package as required. None of my charts are rendering in the BasicUI. I attach a copy of my log below. It appears there are fonts missing. The Azul site indicates there are no fonts included with Java 11. All of the topics I have found re. missing fonts suggest using fontconfig1, which I cannot use on the Synology because their version of Linux does not support apt install. I attempted the solution suggested here: RRD does not work - java null exception · Issue #32 · openhab/openhab-syno-spk · GitHub (namely copying fonts from Raspberry pi to /etc/fonts and /user/share/fonts), but that does not work. Notably, others in that thread (which is closed) mentioned that solution also failed for them.

Does anyone know how I can install the required fonts to get my charts working again? Charts were working fine with OH2.5 and Java 8.

Many thanks,

-Mark

2021-07-11 10:08:53.445 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /chart
java.lang.InternalError: java.lang.reflect.InvocationTargetException
	at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) ~[?:?]
	at java.awt.Font.getFont2D(Font.java:497) ~[?:?]
	at java.awt.Font.defaultLineMetrics(Font.java:2366) ~[?:?]
	at java.awt.Font.getLineMetrics(Font.java:2473) ~[?:?]
	at java.awt.font.TextLayout.fastInit(TextLayout.java:597) ~[?:?]
	at java.awt.font.TextLayout.<init>(TextLayout.java:392) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisTickCalculator.willLabelsFitInTickSpaceHint(AxisTickCalculator.java:148) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisTickDateCalculator.calculate(AxisTickDateCalculator.java:214) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisTickDateCalculator.<init>(AxisTickDateCalculator.java:115) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.getAxisTickCalculator(Axis.java:363) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.getXAxisHeightHint(Axis.java:286) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.paint(Axis.java:180) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisPair.paint(AxisPair.java:147) ~[?:?]
	at org.knowm.xchart.internal.chartpart.ChartPainter.paint(ChartPainter.java:114) ~[?:?]
	at org.knowm.xchart.Chart.paint(Chart.java:102) ~[?:?]
	at org.openhab.core.ui.internal.chart.defaultchartprovider.DefaultChartProvider.createChart(DefaultChartProvider.java:259) ~[?:?]
	at org.openhab.core.ui.internal.chart.ChartServlet.doGet(ChartServlet.java:318) ~[?:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[bundleFile:3.1.0]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[bundleFile:3.1.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) ~[?:?]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) ~[?:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) ~[bundleFile:9.4.40.v20210413]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[?:?]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.40.v20210413]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) ~[?:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:383) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.40.v20210413]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
	at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84) ~[?:?]
	... 55 more
Caused by: java.lang.NullPointerException
	at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262) ~[?:?]
	at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225) ~[?:?]
	at sun.awt.FontConfiguration.init(FontConfiguration.java:107) ~[?:?]
	at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719) ~[?:?]
	at sun.font.SunFontManager$2.run(SunFontManager.java:379) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at sun.font.SunFontManager.<init>(SunFontManager.java:324) ~[?:?]
	at sun.awt.FcFontManager.<init>(FcFontManager.java:35) ~[?:?]
	at sun.awt.X11FontManager.<init>(X11FontManager.java:56) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
	at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84) ~[?:?]
	... 55 more

All-

After much more work on the web, I solved this problem. Since others have had similar issues, I will post the solution.

(1) Download Entware per the instructions posted at this link: Install on Synology NAS · Entware/Entware Wiki · GitHub
This program will allow you to install standard linux packages on the Synology.

(2) Install fontconfig by typing sudo opkg install fontconfig

(3) You will need truetype fonts on your system. I obtained mine from a spare Raspberry Pi that I have. Place the fonts in /usr/share/fonts (you may need to create this directory). I also opened permissions on these directories (sudo chmod 777 for all files). I copied these files to /opt/etc/fonts as well, as the instructions at this page

suggested the font files needed to be there.

(4) Type export FONTCONFIG_PATH=/usr/share/fonts. Note that the site listed in (3) suggested typing FONTCONFIG_PATH=/opt/etc/fonts. I did that as well prior to typing the line above. My knowledge of linux and Java is weak, so I am not sure what typing both did, but I presume the command I typed second overrode the one I typed first.

(5) Restart OpenHAB.

I now have charts rendering on my system. Hopefully this helps others who have this same issue, and if more knowledgeable users want to correct anything above, please do so!

Many thanks,

-Mark

2 Likes

All-

I forgot one key instruction. Immediately prior to (4) above, type
fc-cache -fv
This line runs fontconfig and updates it with what is in the /usr/share/fonts directory. You can type
fc-list
to see what fonts are installed. A long list should appear.

Many thanks,

-Mark

This worked on dsplay415!, I got the font files (/usr/share/fonts/truetype) from a ubuntu server export FONTCONFIG_PATH=/usr/share/fonts is correct.