[SOLVED] Problem: Chart generation failed: null

thank you for your reply,
I tried with your proposal but the same problem

Do you still get WARN “Chart generation failed: null”?
What kind of installation do you use? Version of openHAB, JAVA and OS?

yes the same warn Chart generation failed: null
version openhab: 2.4.0-1
version OS : Windows 10
version java:

java version “1.8.0_201”

Thanks for posting those.
From here on I’m fishing in the dark:
My setting for Charts on PaperUI is Height 240, Width 480. Not sure if those settings will change the issue, but…

…and if the last did not help, would you try to raise the Debug-level IOT get more info what migth went wrong?

If yes, open the Karaf-console and raise the Level by:
log:set DEBUG org.eclipse.smarthome.ui.internal.chart

sorry for the delay because the installation takes time
thank you for your reply
It is working now.
after installation

sudo openhabian-config

Go to “20 Optional Components” > “24 InfluxDB+Grafana” <>
After installation and reboot:

2 Likes

Weird isn’t it. Must reset some shared parameters somewhere.

thank you for your reply, yes it’s Weird

Yes, weird!
It is another example of this, IMHO the message comes from ChartServlet.java (in org.eclipse.smarthome.ui.internal.chart) in the method “doGet” the final try…:

 // Set the content type to that provided by the chart provider
    res.setContentType("image/" + provider.getChartType());
    logger.debug("chart building with width {} height {} dpi {}", width, height, dpi);
    try (ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(res.getOutputStream())) {
        BufferedImage chart = provider.createChart(serviceName, req.getParameter("theme"), timeBegin, timeEnd,
                height, width, req.getParameter("items"), req.getParameter("groups"), dpi, legend);
        ImageIO.write(chart, provider.getChartType().toString(), imageOutputStream);
        logger.debug("Chart successfully generated and written to the response.");
    } catch (ItemNotFoundException e) {
        logger.debug("{}", e.getMessage());
        res.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
    } catch (IllegalArgumentException e) {
        logger.warn("Illegal argument in chart: {}", e.getMessage());
        res.sendError(HttpServletResponse.SC_BAD_REQUEST, "Illegal argument in chart: " + e.getMessage());
    } catch (IIOException e) {
        // this can happen if the request is terminated while the image is streamed, see
        // https://github.com/openhab/openhab-distro/issues/684
        logger.debug("Failed writing image to response stream", e);
    } catch (RuntimeException e) {
        if (logger.isDebugEnabled()) {
            // we also attach the stack trace
            logger.warn("Chart generation failed: {}", e.getMessage(), e);
        } else {
            logger.warn("Chart generation failed: {}", e.getMessage());
        }
        res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    }

Why would a runtime exception the raised?

@imad
since your problem is solved, please mark the thread as resolved!

Edit: You did that already, Thanks!

1 Like

can you tell me please, how i can change the time in chart.
the time in chart and Response Body (1563120000000) it is difference

On REST the time is given in millisecs since some data 1970 or so. The chart does give it human readable. When choosing longer times you will see day-names and dates. That is done automatically for the built-in charts. You can’t change them.
If you need more control over the chart you have to switch to Grafana (more powerfully, more config needed, takes resources from the system…)

thank you :wink:

Hi, I just observed exactly the same problem on my system. It turned out that the package “fontconfig” was missing in my OpenHABian 2.4.0-1. After installing it (“apt-get install fontconfig”) chart generation worked fine. That also expains why installing influxDB + grafana package helps: it installs as dependency also the fontconfig package.

Your hint
“log:set DEBUG org.eclipse.smarthome.ui.internal.chart”
put me on the right track.

Thanks!!

For reference here my system data:
Release = Raspbian GNU/Linux 9 (stretch)
Kernel = Linux 4.19.57-v7+
Platform = Raspberry Pi 2 Model B Rev 1.1
openHAB 2.4.0-1 (Release Build)
openjdk version “1.8.0_212”
OpenJDK Runtime Environment (Zulu8.38.0.163-CA-linux_aarch32hf) (build 1.8.0_212-b163)
OpenJDK Client VM (Zulu8.38.0.163-CA-linux_aarch32hf) (build 25.212-b163, mixed mode, Evaluation)

1 Like

That looks like a good find !

Out of curiosity, is there a quick check for this package? I could not see it in my OH 2.4 bundle:list (that does plots charts from rrd4j just fine)

Humm, poking for that info came across this

1 Like

Good catch!
Now the Questions are:
Are all users, that observe(d) this issue, on a openhabian Installation?
From when was this installaton? Maybe initially from befrore Feb’17?

I used the latest release 1.4.1 from

which is from April 2018.

solution :
sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start

I created an issue for openhabian: https://github.com/openhab/openhabian/issues/597.