Problem accessing /chart

Hi,

I’m trying around using openhab, and have problems with getting any chart running.

When defining an chart and then access the sitemap the chart is not displayed and in the openhab.log is following error:

2017-01-20 20:22:24.556 [WARN ] [eclipse.jetty.servlet.ServletHandler] - /chart
java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)[:1.8.0_101]
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)[:1.8.0_101]
at sun.awt.FontConfiguration.init(FontConfiguration.java:107)[:1.8.0_101]
at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)[:1.8.0_101]
at sun.font.SunFontManager$2.run(SunFontManager.java:431)[:1.8.0_101]
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_101]
at sun.font.SunFontManager.(SunFontManager.java:376)[:1.8.0_101]
at sun.awt.FcFontManager.(FcFontManager.java:35)[:1.8.0_101]
at sun.awt.X11FontManager.(X11FontManager.java:57)[:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)[:1.8.0_101]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)[:1.8.0_101]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)[:1.8.0_101]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)[:1.8.0_101]
at java.lang.Class.newInstance(Class.java:442)[:1.8.0_101]
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)[:1.8.0_101]
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_101]
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)[:1.8.0_101]
at java.awt.Font.getFont2D(Font.java:491)[:1.8.0_101]
at java.awt.Font.defaultLineMetrics(Font.java:2176)[:1.8.0_101]
at java.awt.Font.getLineMetrics(Font.java:2283)[:1.8.0_101]
at java.awt.font.TextLayout.fastInit(TextLayout.java:598)[:1.8.0_101]
at java.awt.font.TextLayout.(TextLayout.java:393)[:1.8.0_101]
at com.xeiam.xchart.internal.chartpart.Axis.getSizeHint(Axis.java:138)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at com.xeiam.xchart.internal.chartpart.Axis.paint(Axis.java:169)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at com.xeiam.xchart.internal.chartpart.AxisPair.paint(AxisPair.java:130)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at com.xeiam.xchart.internal.chartpart.ChartPainter.paint(ChartPainter.java:94)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at com.xeiam.xchart.Chart.paint(Chart.java:105)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at org.eclipse.smarthome.ui.internal.chart.DefaultChartProvider.createChart(DefaultChartProvider.java:225)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at org.eclipse.smarthome.ui.internal.chart.ChartServlet.doGet(ChartServlet.java:190)[136:org.eclipse.smarthome.ui:0.9.0.201701091847]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)[19:javax.servlet-api:3.1.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)[19:javax.servlet-api:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)[79:org.eclipse.jetty.security:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:287)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)[81:org.eclipse.jetty.servlet:9.2.19.v20160908]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)[172:org.ops4j.pax.web.pax-web-jetty:4.3.0]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.Server.handle(Server.java:499)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)[80:org.eclipse.jetty.server:9.2.19.v20160908]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[72:org.eclipse.jetty.io:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[83:org.eclipse.jetty.util:9.2.19.v20160908]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_101]

Here the definitions for the chart and item:

Sitemap:

sitemap charts label=“Chart Tests” {

Frame label="Heizung" icon="chart" {
	Chart item=HeizungKuecheMeasured service="mysql" period=D refresh=30000
}

}

Item:

Number HeizungKuecheMeasured “Kueche Ist-Temp. [%.1f °C]” { fht=“housecode=3622;datapoint=MEASURED_TEMP” }

The mysql persistence is working and writing the measured values in the mysql database. Also the restoreOnStartup feature is working, so the persistence seems not to be the problem.

Even when i try to access the chart via url I receive the same error:

http://mynas:8080/chart?items=HeizungKuecheMeasured&period=h&service=mysql

Anyone who has an idea what I’m doing wrong?

regards,
Olaf

Hallo Olaf,

Could you solve the problem with charts,

i am getting the same error.
I also use mysql as persistence and checked the database for written values.

regards
Sven

Hi,
unfortunately not. Found some hints that it might be related to the java version installed on the synology box. But I did not manage to change the java package from Synology to Oracle …

regards,
Olaf

Hi Olaf

I just checked some of my chart settings, and I do not define service="mysql" in the chart item. Maybe try it without it?

This is my config for Temperature chart:

Frame {
				Switch item=Temperature_Period icon="temperature2" label="Chart Period" mappings=[0="Day", 1="Week", 2="Two weeks"]
				Chart item=Temperature period=D refresh=30000 visibility=[Temperature_Period==0]
				Chart item=Temperature period=W refresh=300000 visibility=[Temperature_Period==1]
				Chart item=Temperature period=2W refresh=300000 visibility=[Temperature_Period==2]}
			}

On a side note:

I’m using persistence on my Synology as well. I have installed:

  • Java8 8.0.101
  • MariaDB 5.5.53 and
  • phpMyAdmin 4.6.5

Persistence in OH2 is JDBC Persistence MariaDB 1.9.0

This works well for me to make charts. It might be worthwhile to check this setup.

The stack trace indicates it’s a problem with either the Java runtime you’re using or how it’s configured. I don’t know the root cause of the issue, but there is no sign that the cause is in openHAB itself. Hopefully there is a Java runtime or a configuraton of it that can get past this for you.

Hallo,

I just changed from the official Openhab Docker Container for armhf with Zulu Java
to an own build Docker Container with Oracle JAVA 8
and all charts are working now.

So the problem seem to depend on the JAVA runtime

regards
Sven