Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » Using e(fx)clipse osgi wrapper inside a maven project
Using e(fx)clipse osgi wrapper inside a maven project [message #1529702] Fri, 26 December 2014 07:32 Go to next message
Eclipse UserFriend
Hey,

yesterday i asked a question in stackoverflow (stackoverflow.com/questions/27650045/eclipse-set-org-osgi-framework-system-packages-extra-to-include-javafx-in-osgi) (the forum is preventing posting links from outside the forum for me) and was redirected by tom to this forum.

My question is about how to include the javafx classpath inside an osgi application properly.
First i tried to use the "org.osgi.framework.system.packages.extra" property to add javafx to the classpath.

This works for equinox installations not running inside eclipse like pax runner that i'm using (github.com/Naios/WIde/blob/osgi_integration/pom.xml#L45).

Tom told me that eclipse is skipping the extra classloader. thats why it doesn't work for equinox normally.

Now i'm asking how i can include the JavaFX classpath in osgi by using the osgi framework launcher only?
I didn't find any tutorial where it is explained how to use e(fx)clipse without using a predefined template (like e(fx)clipse tutorial 1-4).
I'm using an extra eclipse target platform to include osgi bundles like apache aries and the org.eclipse.fx.osgi bundle.

Greetings Denis
Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1530521 is a reply to message #1529702] Fri, 26 December 2014 18:44 Go to previous messageGo to next message
Eclipse UserFriend
I did a lot of reasearch and i'm closer to the solution now.

First of all the maven-bundle-plugin included javafx in "Import-Package" metadata which is quiet bad.
I think equinox looked for another bundle that exported it.
I solved this through adding "!javafx.*, *" to the maven-bundle-plugin.

Secondly i took a look at the "org.eclipse.fx.osgi" bundle and saw that it works through the equinox "ClassLoaderHook".

I tried to enable its debug logs through "efxclipse.osgi.hook.debug" property but it didn't work.

Then i enabled full org.eclipse.osgi trace logs [attached to this post] (file is too huge for pastebin ~2MB) and saw 3 strange things:

1) The org.eclipse.fx.osgi bundle gets looked up after my bundle with javafx was loaded.
2) You can't set a start level of bundles without a BundleActivator through the launch config gui (you need to set it though a launch config.xml and load it again into eclipse) - depends on whether the start level is responsible for when the hook gets registered.
3) The trace logs never show that the org.eclipse.fx.osgi ClassLoaderHook gets registered, if i compare it to the the org.osgi.compatibility.state loading log i would say that equinox is ignoring the fx.osgi bundle but mark it as resolved.

My current console output looks like: pastebin.com/bsTeChjN so you see what bundles are installed/running.

[Updated on: Fri, 26 December 2014 19:12] by Moderator

Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1531000 is a reply to message #1530521] Sat, 27 December 2014 01:15 Go to previous messageGo to next message
Eclipse UserFriend
On 27.12.14 00:44, Denis Blank wrote:
> I did a lot of reasearch and i'm closer to the solution now.
>
> First of all the maven-bundle-plugin included javafx in "Import-Package"
> metadata which is quiet bad.
> I think equinox looked for another bundle that exported it.
> I solved this through adding "!javafx.*, *" to the maven-bundle-plugin.

To make the classloader hook work your MANIFEST.MF has to have javafx
imports!

>
> Secondly i took a look at the "org.eclipse.fx.osgi" bundle and saw that
> it works through the equinox "ClassLoaderHook".
>

Right but you need as stated above the imports for javafx which are
wired against "org.eclipse.fx.javafx" which is an empty bundle which is
hooked by "org.eclipse.fx.osgi"

> I tried to enable its debug logs through "efxclipse.osgi.hook.debug"
> property but it didn't work.
>
> Then i enabled full org.eclipse.osgi trace logs
> [dropbox.com/s/xi4cik7asxv7l8i/osgi-trace.zip] (file is too huge for
> pastebin ~2MB) and saw 3 strange things:
>
> 1) The org.eclipse.fx.osgi bundle gets looked up after my bundle with
> javafx was loaded.

It is a fragment to the system bundle, it is not looked up after your
bundle!

> 2) You can't set a start level of bundles without a BundleActivator
> through the launch config gui (you need to set it though a launch
> config.xml and load it again into eclipse).

Once again the bundle is a fragment it is started with its parent which
is the system bundle!

> 3) The trace logs never show that the org.eclipse.fx.osgi
> ClassLoaderHook gets registered (don't know if there is a debug output
> for that).

To make the hook getting respected they need to be mentionned in the
config.ini when running in an exported application.

It looks like this when our final applications are generated:
.....
osgi.framework.extensions=reference\:file\:org.eclipse.fx.osgi_1.1.0.201411050602.jar
.....

What I'm unclear about is:

Are you haveing problems when launching inside Eclipse or in a exported
state? If it is inside Eclipse you might have simply missed
"-Dosgi.framework.extensions=org.eclipse.fx.osgi"?

If I get your right you are using a pom-first approach in contrast to an
MANIFEST first?

Can I somehow reproduce your problems myself? Is the project hosted
somewhere on a public service like github?

Are you sure you really want to make use of the adapter hook? What are
your java version requirements? If you require Java8 the easiest way as
I said is to use -Dorg.osgi.framework.bundle.parent=ext, no need for
AdapterHooks and javafx imports in your MANIFEST.MF (although they
should not harm!).

Tom
Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1531257 is a reply to message #1531000] Sat, 27 December 2014 04:45 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your quick reply Tom.

It works inside eclipse now after i reverted my changes at the poms, so javafx gets listed as requirement in the metadata again.
Then i added osgi.framework.extensions=org.eclipse.fx.osgi and it worked!

I was talking about a pom-first approach, the code is located here: github.com/Naios/WIde/tree/osgi_integration (its the osgi_integration branch).

The problem only occured inside eclipse, not if i deploy the bundles using the pax:provision maven command (mvn clean install pax:provision), pax runner accepted org.osgi.framework.system.packages.extra (and it's using equinox 3.8 ).

But i'm still wondering about why it didn't work in eclipse with the easier -Dorg.osgi.framework.bundle.parent=ext solution since i'm using oracle jdk 1.8.0_25.

[Updated on: Sat, 27 December 2014 10:03] by Moderator

Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1531807 is a reply to message #1531257] Sat, 27 December 2014 12:10 Go to previous messageGo to next message
Eclipse UserFriend
On 27.12.14 10:45, Denis Blank wrote:
> Thanks for your quick reply tom.
>
> It works now inside eclipse, i reverted my changes at the poms, so
> javafx gets listed as requirement in the metadata again.
> Then i added osgi.framework.extensions=org.eclipse.fx.osgi and it worked!
>
> I was talking about a pom-first approach, the code is located here:
> github.com/Naios/WIde/tree/osgi_integration (its the osgi_integration
> branch).
>
> The problem only occured inside eclipse, not if i deploy the bundles
> using the pax:provision maven command (mvn clean install pax:provision),
> pax runner accepted org.osgi.framework.system.packages.extra (and it's
> using equinox 3.8).

But this means that pax is modifying the classpath or is there the
org.eclipse.fx.osgi bundle in action as well?

>
> But i'm still wondering about why it didn't work in eclipse with the
> easier -Dorg.osgi.framework.bundle.parent=ext solution since i'm using
> oracle jdk 1.8.0_25.
>

For me it worked always like a charme - I'm currently using it in an
Equinox-Nashorn env which requires running with this switch.

Tom
Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1532185 is a reply to message #1531807] Sat, 27 December 2014 17:19 Go to previous messageGo to next message
Eclipse UserFriend
All in all it seems like pax runner reconfigures org.osgi.framework.bootdelegation & org.osgi.framework.system.packages.
-> pastebin.com/Yq53Mxke

Thanks a lot for your time and help Tom.
Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1730482 is a reply to message #1532185] Tue, 26 April 2016 05:09 Go to previous messageGo to next message
Eclipse UserFriend
I have the same problem as you. I tried resolve my issue by adding parameter org.osgi.framework.system.packages.extra and osgi.framework.bundle.parent=ext I used JDK_8 and I don't have idea how resolve this problem. Could you describe me step by step how you resolved problem with java.lang.NoClassDefFoundError ? I'm beginner in OSGi. I use Pax Runner1.8.7 and Equinox platform.
Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1730575 is a reply to message #1730482] Tue, 26 April 2016 14:47 Go to previous messageGo to next message
Eclipse UserFriend
Basically I solved the issue through adding the osgi.framework.extensions=org.eclipse.fx.osgi property in eclipse (while running the org.eclipse.fx.osgi bundle from the e(fx)clipse project), I used the following launch config for debugging inside eclipse: https://github.com/Naios/WIde/blob/master/doc/ide/eclipse/configuration/Launch%20WIde%20in%20OSGI.launch#L19.
For pax runner you may use the following config which should work: https://github.com/Naios/WIde/blob/master/pom.xml#L53 (you may relicense the build files with a license of your choice). The pom uses the org.osgi.framework.system.packages.extra options you mentioned (as I remind those never worked inside eclipse properly thus I used the JavaFX classloader workarround from e(fx)clipse).

[Updated on: Tue, 26 April 2016 14:48] by Moderator

Re: Using e(fx)clipse osgi classloader extension inside a maven project [message #1730702 is a reply to message #1730575] Wed, 27 April 2016 14:12 Go to previous message
Eclipse UserFriend
If you are running on pure FX (no SWT involved) all that's needed is to
make sure Equinox uses the correct classloader strategy.

Tom

On 26.04.16 20:47, Denis Blank wrote:
> Basically I solved the issue through adding the
> osgi.framework.extensions=org.eclipse.fx.osgi property in eclipse (while
> running the org.eclipse.fx.osgi bundle from the e(fx)clipse project), I
> used the following launch config:
> https://github.com/Naios/WIde/blob/master/doc/ide/eclipse/configuration/Launch%20WIde%20in%20OSGI.launch#L19.
>
> For pax runner you may use the following config which should work:
> https://github.com/Naios/WIde/blob/master/pom.xml#L53 (you may relicense
> the build files with a license of your choice). The pom uses the
> org.osgi.framework.system.packages.extra options you mentioned (as I
> remind those never worked inside eclipse properly thus I used the JavaFX
> classloader workarround from e(fx)clipse).
Previous Topic:Linux & JavaFX
Next Topic:Equivalent of BusyIndicator
Goto Forum:
  


Current Time: Tue Oct 14 01:13:04 EDT 2025

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

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

Back to the top