Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » OSGi Service and Toolkit Not Initialized
OSGi Service and Toolkit Not Initialized [message #1717229] Thu, 10 December 2015 21:09 Go to next message
Steve Turner is currently offline Steve TurnerFriend
Messages: 1
Registered: December 2015
Junior Member
I have an RCP 3 application using e(fx)clipse. Some of my plugins can display JavaFX views and components fine. I am running into a problem with some of my plugins though. These use an OSGi service that provide JavaFX components that are placed into a view in a different plug-in.

At first I was getting class not found exceptions for all the JavaFX classes in my service class. I am not sure how I got rid of those, but then I started getting "Toolkit Not Initialized" exceptions.

I then tried creating an activator class for the plugin and in the start method put this in order to initialize the JavaFX environment.
new JFXPanel();

This worked for initializing things in my plugin, but then Eclipse started throwing not on FX application thread exceptions for every view. I am assuming the initialization has to be done on a certain thread or something. Also can I trigger initializing JavaFX on a plugin without a view.

This same code used to work on Java 7 with Eclipse Juno and a very old version of e(fx)clipse. Any help in figuring this out is greatly appreciated.
Re: OSGi Service and Toolkit Not Initialized [message #1717331 is a reply to message #1717229] Fri, 11 December 2015 17:55 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

The problem is that your OSGi-Components get activated before any
FXCanvas instance in created.

I can not explain your JFXPanel() problem because JavaFX always runs on
the same thread SWT does, the best guess I have is that this way FX is
somehow bound to the wrong thread (see also below) :-(

I think your code worked in Java7 because FX2.2 did not check if things
got called on the right thread, FX8 does that hence you see failures.

Anyways there's currently NO public API in FX to bootrap the
FX-Framework - the ones available are:
* Application.launch
* FXCanvas
* JFXPanel

As the Activator could be called on ANY thread I guess you can't even
use Application.launch there. Without further investigation I have no
real solution to your problem, and further investigation is out-of-scope.

The best chance you have is to run the stuff in your IApplication or the
IWorkbenchWindowAdvisor and hope noone is creating an instance of the
OSGi-Service-Components leading to create JavaFX instances.

Tom

On 11.12.15 16:55, Steve Turner wrote:
> I have an RCP 3 application using e(fx)clipse. Some of my plugins can
> display JavaFX views and components fine. I am running into a problem
> with some of my plugins though. These use an OSGi service that provide
> JavaFX components that are placed into a view in a different plug-in.
>
> At first I was getting class not found exceptions for all the JavaFX
> classes in my service class. I am not sure how I got rid of those, but
> then I started getting "Toolkit Not Initialized" exceptions.
>
> I then tried creating an activator class for the plugin and in the start
> method put this in order to initialize the JavaFX environment.
> new JFXPanel();
>
> This worked for initializing things in my plugin, but then Eclipse
> started throwing not on FX application thread exceptions for every view.
> I am assuming the initialization has to be done on a certain thread or
> something. Also can I trigger initializing JavaFX on a plugin without a
> view.
>
> This same code used to work on Java 7 with Eclipse Juno and a very old
> version of e(fx)clipse. Any help in figuring this out is greatly
> appreciated.
Previous Topic:org.eclipse.fx.javafx deprecation?
Next Topic:e(fx)clipse 2.2.0 released
Goto Forum:
  


Current Time: Thu Apr 25 15:59:16 GMT 2024

Powered by FUDForum. Page generated in 0.02941 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top