fair-acc / chart-fx

A scientific charting library focused on performance optimised real-time data visualisation at 25 Hz update rates for data sets with a few 10 thousand up to 5 million data points.
GNU Lesser General Public License v3.0
488 stars 90 forks source link

Exception in Application start method #667

Closed logikdev closed 1 month ago

logikdev commented 1 month ago

I unfortunately get this "Exception in Application start method" error message when launching my app ( packaged using jlink and jpackage ).

final XYChart chart = new XYChart(xAxis, yAxis);
chart.getPlugins().add(new ParameterMeasurements()); 
chart.getPlugins().add(new DataPointTooltip());
chart.getPlugins().add(new Zoomer());

If i comment the ParameterMeasurements() and Zoomer() lines out the app launches fine. The problem is that the charts don't behave like i want them to.

The stack trace points to the Zoomer plugin:

at io.fair_acc.chartfx.plugins.Zoomer.getZoomInteractorBar(Zoomer.java:429) at io.fair_acc.chartfx.plugins.Zoomer.(Zoomer.java:135) at io.fair_acc.chartfx.plugins.Zoomer.(Zoomer.java:260) at io.fair_acc.chartfx.plugins.Zoomer.(Zoomer.java:251)

I've also tested under Mac and Windows with the same results. Any idea where to look to find a solution? Cheers!

Environment:

wirew0rm commented 1 month ago

I have no experience with jlink , but from the description my first guess would be that the issue is that controls-fx (which provides controls that zoomer and parameter measurements depend upon) uses reflection, which is not allowed in a fully modularized java project, which I think is needed for jlink. For running the traditional way, java provides a set of command line arguments to open specific classes to external reflection. I don't know what ways there are with jlink. I tried once to switch chart-fx to being fully modularized, but it was blocked by some of our dependencies not being modularized,

logikdev commented 1 month ago

Thanks for your quick response. The strange thing is that my app works well when launched in my IDE ( vs code ). I looked for any specific command line arguments but i'm not seeing any.

Alternatively, what do you use in order to package an application to be installed like a regular app?

wirew0rm commented 1 month ago

Thanks for your quick response. The strange thing is that my app works well when launched in my IDE ( vs code ). I looked for any specific command line arguments but i'm not seeing any.

This might have to do with class- vs modulepath. I assume that jlink (as the whole concept is based on the modularisation) puts everything on the modulepath, while your ide detects that the project is not modularized and puts it on the classpath, where there are fewer restrictions. Since you can use both paths at the same time and there are some rules on what can be accessed from where this gets complex easily and subtle changes can make the difference if a configuration works or not...

Alternatively, what do you use in order to package an application to be installed like a regular app?

Our own usecase is not focused to endusers, so we can just ship fat-jars and a launcher script. For end uses, while I have not used it myself, conveyor might be an option, which was also contributed to package the chart-fx examples in #580

logikdev commented 1 month ago

Looking more into it i noticed this in the stack trace:

Caused by: java.lang.NoClassDefFoundError: java/util/logging/Logger at org.kordamp.ikonli.AbstractIkonResolver.(AbstractIkonResolver.java:32)

I think this might be caused by something else than jlink.

logikdev commented 1 month ago

I've solved it! For some reason java.logging wasn't pulled by jdeps before being piped into jlink and therefore was missing.

Simply manually adding it to the list of required modules for jlink and all is well.

Cheers!