Java / Chart issue with Docker install (OH5.0.1)?

Due to a HW-issue with my installation, I have had to re-install on a new server and thought I would use the opportunity to move to a docker install. Steep learning curve - but I think I got it :wink:

My HW is AMD64 with 16GB and 250GB storage, running Ubuntu server 25.04 (GNU/Linux 6.14.0-28-generic x86_64) with Docker and Portainer installed.

Openhab in a portainer container is running OH5.0.1. Java version states:

root@homeserver:/openhab# java --version
openjdk 21.0.8 2025-07-15
OpenJDK Runtime Environment (build 21.0.8+9-Debian-1)
OpenJDK 64-Bit Server VM (build 21.0.8+9-Debian-1, mixed mode, sharing)

I have restored my old OH-installation and most seems to work (and very fast). My problem is however, that no charts are shown on the BasicUI and when looking in openhab.log, I see it throws this message:

2025-08-23 08:50:13.585 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /chart
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
	at sun.font.PlatformFontInfo.createFontManager(PlatformFontInfo.java:37) ~[?:?]
	at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:51) ~[?:?]
	at java.awt.Font.getFont2D(Font.java:526) ~[?:?]
	at java.awt.Font.defaultLineMetrics(Font.java:2394) ~[?:?]
	at java.awt.Font.getLineMetrics(Font.java:2501) ~[?:?]
	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:134) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisTickCalculator_Date.calculate(AxisTickCalculator_Date.java:253) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisTickCalculator_Date.<init>(AxisTickCalculator_Date.java:101) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.getAxisTickCalculatorForX(Axis.java:530) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.getAxisTickCalculator(Axis.java:390) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.getXAxisHeightHint(Axis.java:293) ~[?:?]
	at org.knowm.xchart.internal.chartpart.Axis.preparePaint(Axis.java:161) ~[?:?]
	at org.knowm.xchart.internal.chartpart.AxisPair.paint(AxisPair.java:120) ~[?:?]
	at org.knowm.xchart.XYChart.paint(XYChart.java:416) ~[?:?]
	at org.openhab.core.ui.internal.chart.defaultchartprovider.DefaultChartProvider.createChart(DefaultChartProvider.java:305) ~[?:?]
	at org.openhab.core.ui.internal.chart.ChartServlet.doGet(ChartServlet.java:307) ~[?:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:497) ~[bundleFile:4.0.4]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:584) ~[bundleFile:4.0.4]
	at org.ops4j.pax.web.service.spi.servlet.OsgiInitializedServlet.service(OsgiInitializedServlet.java:102) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656) ~[?:?]
	at org.ops4j.pax.web.service.spi.servlet.OsgiFilterChain.doFilter(OsgiFilterChain.java:113) ~[?:?]
	at org.ops4j.pax.web.service.jetty.internal.PaxWebServletHandler.doHandle(PaxWebServletHandler.java:334) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[?:?]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[?:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[?:?]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[?:?]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[?:?]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505) ~[?:?]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[?:?]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[?:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[?:?]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[?:?]
	at org.ops4j.pax.web.service.jetty.internal.PrioritizedHandlerCollection.handle(PrioritizedHandlerCollection.java:96) ~[?:?]
	at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:731) ~[?:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[?:?]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[?:?]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[?:?]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) ~[?:?]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) ~[?:?]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) ~[?:?]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[?:?]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[bundleFile:9.4.57.v20241219]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[bundleFile:9.4.57.v20241219]
	at java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-21-openjdk-amd64/lib/libfontmanager.so: libharfbuzz.so.0: cannot open shared object file: No such file or directory [in thread "qtp1050773533-821"]
	at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
	at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139) ~[?:?]
	at jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:259) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:249) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2427) ~[?:?]
	at java.lang.Runtime.loadLibrary0(Runtime.java:916) ~[?:?]
	at java.lang.System.loadLibrary(System.java:2063) ~[?:?]
	at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:60) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:319) ~[?:?]
	at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:33) ~[?:?]
	at sun.font.SunFontManager$1.run(SunFontManager.java:269) ~[?:?]
	at sun.font.SunFontManager$1.run(SunFontManager.java:267) ~[?:?]
	at java.security.AccessController.doPrivileged(AccessController.java:319) ~[?:?]
	at sun.font.SunFontManager.initStatic(SunFontManager.java:267) ~[?:?]
	at sun.font.SunFontManager.<clinit>(SunFontManager.java:262) ~[?:?]
	... 59 more

Having searched the forum it seems to be connected to java and potentially something missing in the dockerfile. Can anyone point me in the right direction to solve this?

same problem here with 5.0.1 on docker

I managed to find the solution:

I simply threw the whole error-message into ChatGPT5 and asked for a solution. Through suggestions, I narrowed it down to that the package libharfbuzz0b was missing in the docker image.

I did a “apt-get update && apt-get install -y libharfbuzz0b” in the exec console for the container in Portainer. It was indeed missing - and installed without problems. After, I restarted the container - and now have charts.

(rain since midnight - and yes, a good day to tinker with Openhab today)

Since I already have a custom image build, based on openhab/openhab:5.0.1, I have simply added it to be installed when building the image. That has also worked - the chart above is from after having rebuilt and updated the container.

Perhaps the above can help someone else ?

Yes. apt-get install -y libharfbuzz0b worked for me.

Note that the next time the container is created the error will reappear.

I’m the short term, I recommend creating an init script mounted into the container (see the readme on hub.docker.com for the OH image for details) which installs this missing library before OH starts every time the container starts.

The long run solution is to file an issue in the openhab-docker repo to add this missing library to both images.

Agreed. Bug report created (see https://github.com/openhab/openhab-docker/issues/475)

1 Like