Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » ECF Bundles for service discovery in OSGI with Bnd tools(Remote Services, Bnd Tools and OSGI)
ECF Bundles for service discovery in OSGI with Bnd tools [message #1785341] Thu, 12 April 2018 18:26 Go to next message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
Hello, I have been following the OSGI remote services tutorial using ECF. Primarily, I manage my bundles using bndtools in eclipse. My question is regarding necessary bundles both in the service host and service consumer side in order for a generic service discovery and usage to work. Here's a copy of my host's bndrun file, which is of course not registering any service remotely. Also, I wanted more information for service discovery in the client side. Running the same bundles in the client side leads to null pointer exception.

To be specific, what bundles should I run on both service host and client side for remoting? Also, should I change my bundle start level for ECF bundles?

A screenshot of my bundles running in Raspii is also attached.

index.php/fa/32597/0/


Umesh Timalsina
Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785342 is a reply to message #1785341] Thu, 12 April 2018 19:03 Go to previous messageGo to next message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
After a quick reorganization of bundles, I got the following exception.

Exception in thread "BasicTopologyManagerPreRegSrvExporter" java.lang.IllegalArgumentException: Failed to select host container
at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.exportService(RemoteServiceAdmin.java:349)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager.handleServiceRegistering(AbstractTopologyManager.java:466)
at org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManagerImpl.access$0(BasicTopologyManagerImpl.java:1)
at org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManagerImpl$1.run(BasicTopologyManagerImpl.java:90)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.eclipse.ecf.osgi.services.remoteserviceadmin.SelectContainerException: Container does not implement IRemoteServiceContainerAdapter
at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractHostContainerSelector.createRSContainer(AbstractHostContainerSelector.java:382)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractHostContainerSelector.createMatchingContainer(AbstractHostContainerSelector.java:359)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractHostContainerSelector.createAndAddDefaultContainers(AbstractHostContainerSelector.java:296)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractHostContainerSelector.createAndConfigureHostContainers(AbstractHostContainerSelector.java:271)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.HostContainerSelector.selectHostContainers(HostContainerSelector.java:77)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin$1.run(RemoteServiceAdmin.java:323)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.exportService(RemoteServiceAdmin.java:320)




Umesh Timalsina
Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785349 is a reply to message #1785342] Thu, 12 April 2018 20:09 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Umesh,

Your timing on this question is very good. I'm almost completed with an effort that I've been engaged into to

a) Make it easier to consume ECF RS from bndtools-based projects
b) Deal with the problem you are apparently experiencing wrt start levels

Let me explain b. First, I believe that you have all the necessary bundles for both remote service host and remote service client when running.

In previous versions of ECF it was necessary to have the ECF impl of RSA (bundle: org.eclipse.ecf.osgi.service.remoteserviceadmin) be started *after* any distribution providers (e.g. the ecf.generic.server provider). The reason for this is complicated (e.g. has to do with lazy start in Eclipse and using declarative services or not), but the upshot was that now it's no longer necessary to set start levels to get everything started in appropriate order.

For your use case, you can either:

Start this bundle at a start level *before* all others: org.eclipse.equinox.common

and start these two bundles *after* all the others:

org.eclipse.ecf.osgi.services.remoteserviceadmin
org.eclipse.ecf.osgi.services.distribution

OR you could try to use the snapshot of the Photon build, which is here:

http://download.eclipse.org/rt/ecf/snapshot/

Select Show Directory Contents

(in zip file and/or in plugins directory)

Like the examples, you are currently using the zeroconf/jmdns discovery mechanism (bundle org.eclipse.ecf.provider.jmdns), which will only work for discovery on a LAN...and it can be disabled on some LANS so that's something to keep in mind. ECF has a number of other discovery providers though (e.g. etcd, jslp, file-discovery, etc).

Now, about a (making easier to develop RS with bndtools). It has been/is my intention to create an example project with a bnd (i.e. a a bndrun file with all the necessary ECF RSA bundles and deps). Once the ECF Photon release is available at Maven Central people will be able to simply copy the appropriate maven repo to their bndrun file they will be ready to go). By EF agreement, we can't deploy to maven central before actual release, however (June) so between now and then it will be necessary to use a file-system-based repo in bndtools, perhaps hand constructed initially. But it's my plan to work on this bnd projects/example projects as soon as next week, and I would be happy to work on it with you directly, especially if you are willing to share/contribute back what you create with bndtools.

In any event, I think if you are willing to tolerate some changes, it would be better to attempt to use the Photon snapshot. I will commit to supporting you on that either via this forum or directly (my direct email is slewis at composent.com).

Thanks.

Scott


Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785350 is a reply to message #1785341] Thu, 12 April 2018 20:18 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
One more comment:

On Felix it's necessary to also include an 'equinox supplement bundle:

org.eclipse.equinox.supplement

The easiest way to see the bundles necessary for felix is to consult the karaf-feature.xml:

http://download.eclipse.org/rt/ecf/3.13.8/karaf-features.xml

I suggest you consult this list

Also, in your list, I do not think the following are needed/can be removed:

28 Eclipse Preferences Mechanism
29 Eclipse Extension Registry Support

When you move to the Photon version of ECF, you will probably also want to include a new bundle:

org.eclipse.ecf.osgi.services.remoteserviceadmin.console

I haven't put together the Photon release karaf-features.xml, but I will do that prior to release.



This will provide console commands for the ECF RSA implementation.


Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785351 is a reply to message #1785350] Thu, 12 April 2018 20:26 Go to previous messageGo to next message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
Hello Scott,

Thanks for your thorough and detailed reply. I certainly understand the issue now. As far as I know, I have not seen any bnd way of changing bundle start levels, but I could be wrong on this. And thanks for sharing the snapshot version, I will certainly try that out. If I am successful at what I am doing, I will be more than happy to share the whole thing as a nice little tutorial. As far as I know, it has already been days that I have been struggling, before I asked this question here. There are very few resources on remote services out there.


Umesh Timalsina
Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785352 is a reply to message #1785351] Thu, 12 April 2018 20:44 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Umesh Timalsina wrote on Thu, 12 April 2018 16:26
Hello Scott,

Thanks for your thorough and detailed reply. I certainly understand the issue now. As far as I know, I have not seen any bnd way of changing bundle start levels, but I could be wrong on this. And thanks for sharing the snapshot version, I will certainly try that out. If I am successful at what I am doing, I will be more than happy to share the whole thing as a nice little tutorial. As far as I know, it has already been days that I have been struggling, before I asked this question here. There are very few resources on remote services out there.


Yes. I'm doing all I can (for Photon) to help with the few resources problem. Part of the problem is that the specs are still moving (new stuff for R7 will also be in ECF Photon) and there's still much to do wrt tooling...especially since some like bndtools, some do not, some like pde, some do not, etc. It makes it difficult for extensions like RS, as we have to duplicate examples for multiple target environments as well as different toolsets, etc.

But please feel free to ask questions here on this or other thread, or on ecf-dev:

https://accounts.eclipse.org/mailing-list/ecf-dev

or to me directly via email. Please don't fight through things spending days...as I want to know where the difficulties are so that I can address as many of them as possible for Photon.

Since I intend to create a bndtools project with the ecf RS dependencies next week, perhaps we can just get yours working and then I can generalize that. Please let me know how things proceed in any event.





Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785454 is a reply to message #1785352] Sat, 14 April 2018 02:28 Go to previous messageGo to next message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
Hello Scott,

I tried the python snapshot version of the ECF. I was not able to resolve the dependency for org.eclipse.ecf.console because bnd was unable to resolve the OCD (This happens commonly with build dependencies, and requires usage of Provide-Capability macro when I write my own bundle description in bnd). I muddled through other dependencies, and finally was able to get a run. However, there's still no registration of services. Also, since I figured console bundle is to provide a console commands(extend gogo) for remote services. Also, there's no progress with regards to service registration (remotely). I tried this in two two networks and two service hosts(RPI and my Laptop). Every plugin that is in TimeServiceConsumer.generic.zeroconf.product has been selected in -runbundles of bnd. A plain deployment is not working. I am looking into karaf container, hopefully this will be a lot of help.


Umesh Timalsina

[Updated on: Sat, 14 April 2018 02:31]

Report message to a moderator

Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785469 is a reply to message #1785454] Sat, 14 April 2018 15:44 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Umesh,

Umesh Timalsina wrote on Fri, 13 April 2018 22:28
Hello Scott,

I tried the python snapshot version of the ECF. I was not able to resolve the dependency for org.eclipse.ecf.console because bnd was unable to resolve the OCD (This happens commonly with build dependencies, and requires usage of Provide-Capability macro when I write my own bundle description in bnd).



Hmm. I don't think I saw this before in my earlier bndtools tests. I'll take another look. Just to make sure: what version of bndtools (and Eclipse) are you using?

Quote:

I muddled through other dependencies, and finally was able to get a run. However, there's still no registration of services.



Ok. So that I can try/test under the same conditions: what service are you registering? Is it one of the ECF examples or something else?

Quote:


Also, since I figured console bundle is to provide a console commands(extend gogo) for remote services.



Yes, that's right...gogo is a new dependency for the console bundles. Forgot about that.

Quote:


Also, there's no progress with regards to service registration (remotely). I tried this in two two networks and two service hosts(RPI and my Laptop).



Ok. With the remoteserviceadmin.console bundle, it should report remote service registration with endpoint description xml to the console (by default). So if you aren't getting that then it's like that something else is wrong. WRT the service discovery (zeroconf), that will *only* work on a LAN (since it uses multicast). But since you aren't getting the remote service registration console output, I don't think it's getting that far.

Quote:


Every plugin that is in TimeServiceConsumer.generic.zeroconf.product has been selected in -runbundles of bnd. A plain deployment is not working. I am looking into karaf container, hopefully this will be a lot of help.


We do have full support for deployment to Karaf 4:

https://wiki.eclipse.org/EIG:Install_TimeService_Tutorial_into_Apache_Karaf

This is not yet been updated, however, for the snapshot version...i.e. it's still the previous version of ECF. I will update that after I get the bndtools support working :). The reason this works with Karaf and not bndtools is Karaf has support for start levels. Now (snapshot) that start levels are not necessary/supported (bndtools) the use of Karaf start levels will be removed for Photon.

I'll be working on the bndtools support today/over next couple of days. I've create a new bug/enhancement for this here so that I can track:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=533581

I would very much appreciate it if you would copy/paste your report into this bug, and I will follow up in comments and present status as we make progress.

Thanks!

Scott

Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785483 is a reply to message #1785454] Sun, 15 April 2018 03:46 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi Umesh,

I was able to create a bnd workspace and a few test bundles and get them working (e.g. exporting, discovery, importing, rpc) with the latest ECF snapshot. What I would like to do is make the workspace available to you for trial/testing and then I'll do the finishing work in order to check it in and make it available. Since ECF Photon hasn't been released yet, it can't be at maven central and so I added the necessary bundles to the bnd/cnf local repository. This makes the cnf project larger, however, and so I can't attach it to this forum (which has a limit on attachment sizes that is too small).

I tried to send it to your email at siu.edu, but that bounced also because the attachment was ~2meg. In any event, if you can let me know how I can make this ~2meg zip file available then you can give it a try.

Thanks,

Scott
Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785504 is a reply to message #1785483] Mon, 16 April 2018 02:08 Go to previous messageGo to next message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
Hello Scott,
Thanks a lot. I appreciate that. Today, I looked into Apache karaf. Made my remote services bundles out of bnd and deployed them both in PI and my computer. For deployment I did a feature install in karaf as mentioned on the eclipse website. I still had no success still I think that's the issue with my lan, I will try this again on university's lan. But anyway, I am starting to realize the importance of containers and how they can make your life easier. Also, my email address is umesh.timalsina@siu.edu or umesh.timalsina@ioe.edu.np. I would love to have that bnd workspace as I have to deploy a lot of remote bundles as part of what I am currently doing. I have been writing OSGi for a month or two, the more I dive in more fascinating it becomes. I really appreciate all the effort you have put on this.


Umesh Timalsina
Re: ECF Bundles for service discovery in OSGI with Bnd tools [message #1785505 is a reply to message #1785483] Mon, 16 April 2018 02:11 Go to previous message
Umesh Timalsina is currently offline Umesh TimalsinaFriend
Messages: 7
Registered: April 2018
Location: Carbondale, IL
Junior Member
Also, I am cool with cloning any repository where you have stored/ pushed the files for this CNF folder.

Umesh Timalsina
Previous Topic:Selecting best implementation for Remote Service
Next Topic:Different ECF OSGi remote services (Neon.3 vs Photon) do not work together
Goto Forum:
  


Current Time: Thu Apr 25 01:21:03 GMT 2024

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

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

Back to the top