Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » Hello example over network(Unable to detect host/consumer over network)
Hello example over network [message #1235173] Thu, 23 January 2014 18:16 Go to next message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
Hi there,

I'm new to ECF, hoping to use it for our project, and am trying to get to grips with the examples. I'm following the 'hello' example: http://wiki.eclipse.org/EIG:Getting_Started_with_OSGi_Remote_Services and trying to run the (zeroconf/generic).products for the basic Hello Service Consumer and Hello Service Host.

Running both the host and consumer on the same machine works fine. If I try to run them on two separate machines (connected directly via an ethernet cable), they are unable to discover each other. Could this be an issue with the machines blocking the port? I'm running Mac OS X Mavericks on both.

I've attached logs from both machines - including the list of plugins running. One thing that I guess it might be related to is the message printed on the host:

Quote:

!ENTRY org.eclipse.ecf.osgi.services.remoteserviceadmin 4 0 2014-01-23 17:30:21.617
!MESSAGE org.eclipse.core.runtime.Status[plugin=org.eclipse.ecf.osgi.services.remoteserviceadmin;code=4;message=org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin:postEvent:No EventAdmin service available to send eventTopic=org/osgi/service/remoteserviceadmin/EXPORT_REGISTRATION eventProperties={endpoint.service.id=1, event=RemoteServiceAdminEvent[containerID=StringID[ecftcp://localhost:3787/server], getType()=2, getSource()=org.eclipse.ecf.osgi.services.remoteserviceadmin_3.0.0.v20131027-1505 [2], getException()=null, getImportReference()=null, getExportReference()=org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin$ExportReference@6b61be00], bundle.id=2, export.registration=ECFEndpointDescription[id=ecftcp://localhost:3787/server;endpoint.service.id=1;frameworkid=b0dc6905-5484-0013-104c-c952377792d4], objectClass=[Ljava.lang.String;@5e012913, endpoint.framework.uuid=b0dc6905-5484-0013-104c-c952377792d4, timestamp=1390498221613, endpoint.id=ecftcp://localhost:3787/server, service.imported.configs=[Ljava.lang.String;@1e2fce9c, bundle.symbolicname=org.eclipse.ecf.osgi.services.remoteserviceadmin, bundle=org.eclipse.ecf.osgi.services.remoteserviceadmin_3.0.0.v20131027-1505 [2], bundle.version=3.0.0.v20131027-1505, bundle.signer=[Ljava.lang.String;@54a5733f};severity4;exception=null;children=[]]
Host: Hello Service Registered


Furthermore, the (zeroconf,generic) products are the only ones I can get to talk to each other at all - none of the other products that ship with the examples detect each other locally or via the network. The (edef,generic) products simply don't do anything (host starts fine, consumer just loads osgi console). The (zookeeper, generic) products just load the osgi console. For the (*, r--osgi) products, the host doesn't run because I'm missing a package "org.objectweb.asm", and the consumer doesn't run because it doesn't recognise the container type "ecf.r_osgi.peer". I'm not too fussed about getting these working, as zeroconf is likely to be enough for me, however, I thought I should give you as much information as possible just in case it helps to solve the original problem.

I haven't changed any of the examples' code.

Many thanks,
Jim
Re: Hello example over network [message #1235212 is a reply to message #1235173] Thu, 23 January 2014 20:42 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi James,

Quote:
Running both the host and consumer on the same machine works fine. If I try to run them on two separate machines (connected directly via an ethernet cable), they are unable to discover each other. Could this be an issue with the machines blocking the port? I'm running Mac OS X Mavericks on both.


It's possible that there is a port problem, but I *think* from your export registration info that the problem is that the default containerId is set to the default...i.e. localhost:

ecftcp://localhost:3787/server

This works fine when both the consumer and the host are running on 'localhost', but when the host is running on some other host, the client can't reach it at 'localhost'...even when/if discovered. So, first, this needs to be set to something like:

ecftcp://your.host.name.or.ip.address:3787/server

One of the program arguments in these *.product configurations is this one:

-containerId ecftcp://localhost:3787/server

If you change this to

-containerId ecftcp://your.host.name.or.ip.address:3787/server

Then it should allow the consumer/client to reach your host over a network (given that your.host.name.or.ip.address will be something that the consumer/client can reach).

Now...unfortunately it is also possible that the zeroconf discovery has been/is disabled on your LAN...and/or various ports could be restricted on your host and/or consumer machines (although it sounds as if zeroconf is working when both host and consumer are running on localhost).

There are configuration properties for the generic provider and r-osgi provider, a page with all of these specified is:

http://wiki.eclipse.org/EIG:Configuration_Properties

Zookeeper's specifically:

http://wiki.eclipse.org/Zoodiscovery#How_to_configure_ZooDiscovery_container.3F

WRT to the other discovery/distribution providers (e.g. zookeeper+generic, zookeeper+r-osgi, etc). I'm not sure why these aren't working for you. They are working for me/us when running on localhost, but it's possible there is some problem/interaction with version of Eclipse and/or something else. If you would, I would appreciate it if you would open a new bug (perhaps one specifically for r-osgi to start), and I/we will help diagnose on that bug. To open a bug, got to:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=ECF

and choose the ecf.providers component, and put [r-osgi] at the beginning of the subject. That way other ECF committers will be able to help diagnose and/or provide necessary info.

WRT the edef products...for the consumers it's necessary to explicitly start the edef bundle to get the discovery to occur. Although admittedly not ideal, there are some reasons for this extra step for the examples. Here's a page that documents how to do this:

http://wiki.eclipse.org/File-based_Discovery_with_the_Endpoint_Description_Extender_Format

See section 'Running EDEF Hello Example...' on the above page.

BTW, we understand that the selection of a discovery (and distribution) provider is somewhat complicated (e.g. zookeeper?, zeroconf, dnssd?, etc)...and we are doing some things now...with the OSGi RSA specification...to help with this. The usefulness of this flexibility, however, is pretty helpful, as we and others have found that it's common for remote service developers to change/use different discovery (and distribution) providers under different situations (e.g. for development vs. deployment)...without making fundamental changes to the remote service and/or consumers of that remote service.

It does have the negative side effect, however, that some examples can work in one network environment but not in others. We are trying to mitigate those negative side effects.
Re: Hello example over network [message #1235248 is a reply to message #1235212] Thu, 23 January 2014 22:51 Go to previous messageGo to next message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
Hi Scott,

Thanks for your fast and detailed response! I've changed the -containerId flag to my IP address (ping-able from the other machine) and they still don't connect. Is there a way for a client to test the existence of a remote service without running ECF and OSGI? E.g. a ping-like tool that the client can use "ping ecftcp://my.server.ip:3787/server", or just some very simple test case?

One other thing I've noticed (on more than one machine) is that the host application often crashes. Sometimes when I try to terminate it using the red stop button, I get a "Terminate failed" error message and need to manually kill the java process. Might this be related? Perhaps the host is trying to make the connection but gets into an error state?

I'll take a look at the other providers tomorrow and raise a bug report as you suggest. I agree with you that it is nice to support many different discovery providers Smile

Thanks again,
Jim
Re: Hello example over network [message #1235259 is a reply to message #1235248] Thu, 23 January 2014 23:38 Go to previous messageGo to next message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
Hi Scott,

Quick update: I found this page: http://www.eclipse.org/ecf/documentation.php#Container Connection and tried to connect to the server manually. I added the following lines in HelloConsumerApplication.java:start() just before the waitForDone() call:

 
IContainer cont = getContainerFactory().createContainer("ecf.generic.client");
       cont.addListener(new IContainerListener() {
		public void handleEvent(IContainerEvent event) {
			if (event instanceof IContainerConnectingEvent) {
				System.out.println("Connecting...");
			} else if (event instanceof IContainerConnectedEvent) {
				System.out.println("Connected!");
			} else {
				System.out.println("Event: " + event);
			}	
		}
	});
       // make targetID
       ID targetID = IDFactory.getDefault().createID(cont.getConnectNamespace(),"ecftcp://169.254.188.136:3787/server");
       // then connect to targetID with null authentication data
       cont.connect(targetID,null);
		
	System.out.println("Connected to: "+cont.getConnectedID());


Which resulted in the following output:

Quote:

osgi> Hello Consumer Application
Connecting...
Connected!
Connected to: StringID[ecftcp://169.254.188.136:3787/server]


So I'm able to directly connect, but the ServiceTracker doesn't find it... Instead of using the createRemoteFilter() call to produce a Filter to pass to the ServiceTracker constructor, I've tried the alternate: helloServiceTracker = new ServiceTracker(bundleContext, IHello.class, this); which also doesn't do anything.

Will keep trying.
-J

[Updated on: Thu, 23 January 2014 23:58]

Report message to a moderator

Re: Hello example over network [message #1237769 is a reply to message #1235259] Thu, 30 January 2014 14:49 Go to previous messageGo to next message
James Williams is currently offline James WilliamsFriend
Messages: 27
Registered: July 2009
Junior Member
Hi there,

I was wondering if there's any news on this? I've not been able to make any progress at my end Sad

Cheers,
Jim
Re: Hello example over network [message #1238264 is a reply to message #1237769] Fri, 31 January 2014 21:05 Go to previous message
Eclipse UserFriend
On 01/30/2014 03:49 PM, James Williams wrote:
> I was wondering if there's any news on this? I've not been able to make
> any progress at my end :(

Hi Jim,

can you post the trace for the setup/deployment that doesn't work after
you changed the container id?

Thanks
Markus

PS: WRT org.objectweb.asm, you will find it in our p2 repository, e.g.
http://download.ecf-project.org/repo/C-HEAD-remoteservice.rosgi.feature/lastSuccessful/archive/site.p2/plugins/
Previous Topic:ECF WebSocket provider
Next Topic:Make an service that is already registered remote?
Goto Forum:
  


Current Time: Thu Apr 25 21:46:48 GMT 2024

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

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

Back to the top