e(fx)clipse runtime works on JRE8 but not JRE7 [message #1714944] |
Tue, 17 November 2015 14:41  |
Eclipse User |
|
|
|
We have an OSGi system that's an in-house UI framework and we are trying to start incorporating FX UIs using e(fx)clipse runtime jars. To get this to work we cobbled together alot of forum postings to come up with the following procedure
We have added the following jars (from our eclipse plugins directory) to the target platform:
org.eclipse.fx.javafx_2.2.0_201411050602.jar
org.eclipse.fx.osgi_1.1.0_2014110500602.jar
Then we upgraded to org.eclipse.osgi_3.10.100.v20150529-1857.jar to resolve a complaint that we are missing Require-Capability: osgi.ee; filter="(&(osgi.ee=JavaSE)(version=1.8 ))
We added -Dosgi.framework.extensions=org.eclipse.fx.osgi and -Dorg.osgi.framework.bundle.parent=ext
Any bundles that use FX code now have a dependency on the org.eclipse.fx.javafx plugin.
This setup was working fine in both dev and release environment (more on that in a second) under JRE8. Then we found out we had to go back to using JRE7, now it runs in our dev environment through eclipse, but when we try to run in release environment it fails with NoClassDefFoundErrors on all of the JavaFX dependencies from our bundles.
Our release environment is a bat file that runs the org.eclipse.osgi jar with a pointer to our config.ini file, and some command line switches for the framework hooks as described above. The config.ini contains the bundles we are launching, including the org.eclipse.fx.javafx.
When we examine things on the console it shows that OSGi integration for JavaFX is RESOLVED, and all of our bundles are marked as ACTIVE including the "Fake bundle for Javafx" and all of our bundles that depend on it (i.e. have Require-Bundle set to include org.eclipse.fx.javafx). But as soon as we hit the point in the code where it needs JavaFX classes we get the NoClassDefFoundErrors.
I'm wondering if maybe it's the version of the e(fx)clipse runtime I'm using that just doesn't support JRE7? Or is there some part of the configuration I'm missing? I don't understand why the e(fx)clipse runtime bundles seem to load fine but the dependency isn't found, Not to mention why it seems to work running in eclipse, and under JRE8 but not outside eclipse in JRE7.
I'd really appreciate some help here. Thanks!
|
|
|
Re: e(fx)clipse runtime works on JRE8 but not JRE7 [message #1714957 is a reply to message #1714944] |
Tue, 17 November 2015 17:29   |
Eclipse User |
|
|
|
Hi,
a) do you require FXCanvas?
b) -Dorg.osgi.framework.bundle.parent=ext has no effect on Java7
because JavaFX is not on a classpath at all
c) if you run on Equinox 3.10 the 1.1.0 hooks can not work as the API
has changed so you need the 2.2.0 adapter hooks
d) if you run with the 2.2.0 adapter hooks you
- should remove org.eclipse.fx.javafx from your target it is not
required anymore
- you have to remove package imports/require bundles to javafx.* and
org.eclipse.fx.javafx as well
e) it is an absolute must that the adapter-hook and osgi.jar at
physically next to each other
f) you can debug the adapter hook with -Defxclipse.osgi.hook.debug=true
Tom
On 17.11.15 22:37, Chris Hogan wrote:
> We have an OSGi system that's an in-house UI framework and we are trying
> to start incorporating FX UIs using e(fx)clipse runtime jars. To get
> this to work we cobbled together alot of forum postings to come up with
> the following procedure
>
> We have added the following jars (from our eclipse plugins directory) to
> the target platform:
> org.eclipse.fx.javafx_2.2.0_201411050602.jar
> org.eclipse.fx.osgi_1.1.0_2014110500602.jar
>
> Then we upgraded to org.eclipse.osgi_3.10.100.v20150529-1857.jar to
> resolve a complaint that we are missing Require-Capability: osgi.ee;
> filter="(&(osgi.ee=JavaSE)(version=1.8 ))
>
> We added -Dosgi.framework.extensions=org.eclipse.fx.osgi and
> -Dorg.osgi.framework.bundle.parent=ext
>
> Any bundles that use FX code now have a dependency on the
> org.eclipse.fx.javafx plugin.
>
> This setup was working fine in both dev and release environment (more on
> that in a second) under JRE8. Then we found out we had to go back to
> using JRE7, now it runs in our dev environment through eclipse, but when
> we try to run in release environment it fails with NoClassDefFoundErrors
> on all of the JavaFX dependencies from our bundles.
>
> Our release environment is a bat file that runs the org.eclipse.osgi jar
> with a pointer to our config.ini file, and some command line switches
> for the framework hooks as described above. The config.ini contains the
> bundles we are launching, including the org.eclipse.fx.javafx.
>
> When we examine things on the console it shows that OSGi integration for
> JavaFX is RESOLVED, and all of our bundles are marked as ACTIVE
> including the "Fake bundle for Javafx" and all of our bundles that
> depend on it (i.e. have Require-Bundle set to include
> org.eclipse.fx.javafx). But as soon as we hit the point in the code
> where it needs JavaFX classes we get the NoClassDefFoundErrors.
>
> I'm wondering if maybe it's the version of the e(fx)clipse runtime I'm
> using that just doesn't support JRE7? Or is there some part of the
> configuration I'm missing? I don't understand why the e(fx)clipse
> runtime bundles seem to load fine but the dependency isn't found, Not to
> mention why it seems to work running in eclipse, and under JRE8 but not
> outside eclipse in JRE7.
>
> I'd really appreciate some help here. Thanks!
|
|
|
Re: e(fx)clipse runtime works on JRE8 but not JRE7 [message #1715064 is a reply to message #1714957] |
Wed, 18 November 2015 17:44   |
Eclipse User |
|
|
|
Tom,
Thanks so much for your reply, and I apologize in advance for any stupid questions I may ask, as I haven't been working in OSGi very long.
a) No FXCanvas, I'm not using any SWT stuff, just swing, so my integration is through JFXPanels
b) Very good to know, thank you! So there should be no value set for the org.osgi.framework.bundle.parent option, I'll remove those.
c) Where can I get the 2.2.0 adapter hook? The releases are only up to 2.1.0 from what I can see and I'm not sure how to build the main git project to produce a plugin. Where can I get a 2.2.0 target platform?
More to the point, I don't have anything forcing me to keep using 3.10 (I think we went forward to that one because we were originally using JDK8 and that's what Mars was using, which had better JDK8 integration or something), so if I were to go back to Luna or some other version of eclipse, is there a list somewhere of which adapter hook versions are compatible with which versions of org.eclipse.osgi?
d) Does this only apply for 2.2.0+ or would this apply to the 2.1.0 adapter hook?
e) I've definitely been doing this.
f) I have seen that in a few different threads around the web but I have yet to get it to work....what should I be looking for in the output to indicate that switch is working? And is there anything required to get it to work other than just adding it to the command line?
Finally, one question for you. I came across a stackoverflow (not allowed to link to it yet, but the title is "e(fx)clipse 0.9.0 on Kepler with Java 7") where you said what I interpreted to mean that newer versions (i.e. 0.9.0+) required Java8. That's why at one point I started trying to find a combination that would work with 0.9.0...did I misinterpret that? I should be able to get any version of the efxclipse runtime to work with JRE7 right?
Thanks again!
[Updated on: Wed, 18 November 2015 20:33] by Moderator
|
|
|
|
|
|
Re: e(fx)clipse runtime works on JRE8 but not JRE7 [message #1715182 is a reply to message #1715103] |
Thu, 19 November 2015 15:55  |
Eclipse User |
|
|
|
Unfortunately I can't post any logs from this program. As I said I also can't seem to get the -Defxclipse.osgi.hook.debug=true flag to print anything, I'm not sure why.
On the bright side I think I've resolved the problem. We had been using a command line similar to the following to launch our software
java -jar org.eclipse.osgi.jar
(The default entrypoint for the framework jar is the EclipseStarter) and that seemed to be ignoring the extensions parameter or something (e.g. even with -verbose flag set I couldn't see anything about the FXClassLoader in the logs)
I noticed that the command line eclipse was using to start the application was something along the lines of this
java -classpath <org.eclipse.equinox.launcher.jar> org.eclipse.equinox.launcher.Main
So I edited the run.bat to use the equinox launcher rather than the EclipseStarter and that seems to have resolved my issue.
In the process of trying to figure out what to do I came across another forum thread in which the poster seems to have run across this same issue (and I think found a way to skirt the issue if I follow correctly). Anyway it seems like the EclipseStarter may be ignoring some of the command line switches that the Equinox Launcher is not.
https://www.eclipse.org/forums/index.php/t/970283/
Hopefully this all made sense. Thanks again for your prompt replies, you've been most helpful!
|
|
|
Powered by
FUDForum. Page generated in 0.10034 seconds