Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in Application start method #667

Closed
logikdev opened this issue May 14, 2024 · 5 comments
Closed

Exception in Application start method #667

logikdev opened this issue May 14, 2024 · 5 comments

Comments

@logikdev
Copy link

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:

  • OS: [e.g. Ubuntu 22.04]
  • Java version: 20
  • JavaFx version: 17
  • ChartFx version: 11.3
@wirew0rm
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants