Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Remote service Restlet example question

Hi Scott,

Thank you for the timely reply, it was very helpful.  My comments are in-line below.

Kind regards,
-Alan

On Aug 23, 2012, at 9:06 PM, Scott Lewis wrote:

Hi Alan,

One possibility is that the hostname has to be set on the server/service host (it currently defaults to 'localhost'...and it doesn't sound like this is right for your environment).  This can be set with the following system property (e.g. given on the command line):

-Dorg.eclipse.ecf.remoteservice.restlet.exporturl.host=my.hostname.com

Note that there are others...with these as defaults:

-Dorg.eclipse.ecf.remoteservice.restlet.exporturl.protocol=http
-Dorg.eclipse.ecf.remoteservice.restlet.exporturl.port=8080

You might try setting these on the server/service host process.

BTW...have you tried running both the server/service host and the consumer on the same system (localhost)?  If localhost works but separate hosts do not, then it very likely is an issue with the server hostname as described above.

[Alan]  So far I have only run on a single system, Mac OS X, by way of localhost.  As a result I believe that I am benefitting from all of the default settings.  


Another possibility is that this example uses the zeroconf discovery provider (org.eclipse.ecf.provider.jmdns bundle), and it's quite possible that the network you are on does not support the zeroconf protocol.  I suspect that this could also be why your service is not being discovered.   

[Alan] Good catch.  I run Mac OS X 10.6.  I have verified that mDNSResponder is up and running.  What is strange is that the host service appears to be available according to the OSGi console, but the Bonjour Browser does not list it.  I wonder if there is some incompatibility between osgi-enabled-jmdns and Bonjour on the Mac?  Probably something really simple that I am just missing.  To the best of my knowledge I've not had multicast difficulties before (we use multicast for grid development), but I can look into this further.  

[Alan] That said, I think that I will turn my attention toward the xml-file (EDEF?) based approach so as not to be constrained by either multicast or proximity between host and consumer (the assumption being that the xml-file based approach would work well for service discovery over a WAN or the I-Net?).

In any case...I've been meaning to create another example...that uses some other discovery provider (e.g. the xml-file based provider so that no requirements needed for network support...as various networks allow/disallow the multicast traffic used by zeroconf and other network discovery protocols.  If you would like such an example, please open an enhancement request to that effect and we'll start down that road.

[Alan] That would be very helpful.  I submitted this enhancement request as Bug 387031.  If I did this incorrectly or incompletely please let me know.

[Alan] Ultimately I want to deploy the host by way of gemini blueprint.   In the near term, would you recommend that I extrapolate from a combination of the rest, EDEF and DS examples to accomplish this?  Perhaps there a more direct route?

Thanks again,
-Alan



Thanks,

Scott



On 8/9/2012 6:32 PM, alans@xxxxxxxx wrote:
Hello,

My apology for the length of this post.  

In running the remote services Restlet example all of the bundles are active as expected but the consumer fails silently, leading me to believe that I am missing a bundle or have the wrong set of bundles or am mixing versions inappropriately (the OSGi console short status for the host and consumer are at the bottom of this post).

The specific problem is that while the start(IApplicationContext) is called on the consumer's HelloConsumerApplication, the addingService(ServiceReference<IHelloResource>) is not called.  No exceptions are thrown.  It simply fails silently.

I believe that the host is working as expected. The IHelloResource appears to be available (see bundle report at the bottom of the post), and Restlet is listening on port 8080:

$ nc -z localhost 8080
Connection to localhost 8080 port [tcp/http-alt] succeeded!

The setup that I am using follows.

Eclipse IDE:
Version: Juno Release
Build id: 20120614-1722

Target Definition for both consumer and host:
${eclipse_home}
ECF Target Components Feature - http://download.eclipse.org/rt/ecf/3.5.6/site.p2
Restlet Update Site - http://p2.restlet.org/2.2

I am using the Restlet 2.2 SNAPSHOT, which includes Bryan Hunt's osgi extension, because the RestletClientContainer in the ecf provider has a dependency on org.restlet.engine.resource.AnnotationUtils.getInstance() that is not satisfied by Restlet 2.1.

The restlet provider was obtained from https://github.com/ECF/RestletProvider.git where there is only a [master] version.  These projects are imported to both the host and consumer IDE instances:

/org.eclipse.ecf.provider.restlet
/org.eclipse.ecf.remoteservice.tm.restlet

The examples were taken from the [master] version of  git://git.eclipse.org/gitroot/ecf/org.eclipse.ecf.git

I have two Eclipse IDE instances, one running the consumer and the other running the host.  On the host side I have imported these example projects:

/org.eclipse.ecf.examples.remoteservice.restlet.hello
/org.eclipse.ecf.examples.remoteservice.restlet.hello.host

On the consumer side I have imported these example projects;

/org.eclipse.ecf.examples.remoteservice.restlet.hello
/org.eclipse.ecf.examples.remoteservice.restlet.hello.consumer

The host launcher, "Restlet RSA Server.launch", is setup a bit different than my own with regard to what it assumes is in the "target_bundles" versus what are "workspace_bundles".  That said, I believe that I reconciled what bundles are expected overall with the exception of a jetty "target_bundle", org.mortbay.jetty.util@default:default.  It was not clear to me where this might have come from since versions 7 and 8 of Jetty are packaged as "org.eclipse" bundles.  Nevertheless, the absence of this bundle did not keep the other bundles from becoming active.

The consumer launcher, "Restlet Hello Consumer.launch", went through the same reconciliation process for the bundles that are expected.  I also validated the plug-ins in the run configuration.  

The short status (ss) from the OSGi console follows for the host:

id State       Bundle
0 ACTIVE      org.eclipse.osgi_3.8.0.v20120529-1548
45 ACTIVE      org.apache.commons.httpclient_3.1.0.v201012070820
46 ACTIVE      org.eclipse.jetty.servlet_8.1.3.v20120522
47 ACTIVE      org.eclipse.ecf.discovery_4.0.0.v20120610-1946
49 ACTIVE      org.eclipse.ecf.remoteservice.tm.restlet_1.0.0.qualifier
50 ACTIVE      org.eclipse.equinox.console_1.0.0.v20120522-1841
51 ACTIVE      org.eclipse.equinox.http.servlet_1.1.300.v20120522-1841
52 ACTIVE      org.eclipse.ecf_3.1.300.v20120610-1946
            Fragments=60
54 ACTIVE      org.apache.felix.gogo.shell_0.8.0.v201110170705
55 ACTIVE      org.eclipse.jetty.http_8.1.3.v20120522
56 ACTIVE      javax.servlet_3.0.0.v201112011016
57 RESOLVED    org.eclipse.core.runtime.compatibility.registry_3.5.100.v20120521-2346
            Master=78
58 ACTIVE      org.apache.ant_1.8.3.v20120321-1730
59 ACTIVE      org.eclipse.jetty.util_8.1.3.v20120522
60 RESOLVED    org.eclipse.ecf.ssl_1.0.100.v20120610-1946
            Master=52
61 ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin_2.1.0.v20120610-1946
62 ACTIVE      org.eclipse.ecf.identity_3.1.200.v20120610-1946
63 ACTIVE      org.eclipse.equinox.common_3.6.100.v20120522-1841
64 ACTIVE      org.eclipse.jetty.continuation_8.1.3.v20120522
65 ACTIVE      javax.servlet.jsp_2.2.0.v201112011158
66 ACTIVE      org.eclipse.jetty.server_8.1.3.v20120522
67 ACTIVE      org.eclipse.osgi.services_3.3.100.v20120522-1822
68 ACTIVE      org.apache.felix.gogo.runtime_0.8.0.v201108120515
69 ACTIVE      org.eclipse.equinox.ds_1.4.0.v20120522-1841
70 ACTIVE      org.apache.commons.logging_1.0.4.v201101211617
72 ACTIVE      javax.el_2.2.0.v201108011116
73 ACTIVE      org.eclipse.ecf.remoteservice_6.0.200.v20120610-1946
74 ACTIVE      org.eclipse.equinox.util_1.0.400.v20120522-2049
75 ACTIVE      org.eclipse.ecf.remoteservice.rest_2.2.200.v20120610-1946
76 ACTIVE      org.apache.felix.gogo.command_0.8.0.v201108120515
77 ACTIVE      org.eclipse.core.jobs_3.5.200.v20120521-2346
78 ACTIVE      org.eclipse.equinox.registry_3.5.200.v20120522-1841
            Fragments=57
79 ACTIVE      org.eclipse.jetty.io_8.1.3.v20120522
80 ACTIVE      org.eclipse.jetty.security_8.1.3.v20120522
81 ACTIVE      org.eclipse.ecf.provider.restlet_1.0.0.qualifier
82 ACTIVE      org.eclipse.ecf.examples.remoteservice.restlet.hello.host_1.0.0.qualifier
83 ACTIVE      org.eclipse.equinox.http.jetty_3.0.0.v20120522-1841
84 ACTIVE      org.eclipse.equinox.concurrent_1.0.300.v20120522-2049
85 ACTIVE      org.eclipse.ecf.examples.remoteservice.restlet.hello_1.0.0.qualifier
86 ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy_1.0.0.v20120610-1946
87 ACTIVE      org.apache.commons.codec_1.3.0.v201101211617
88 ACTIVE      org.eclipse.osgi.services.remoteserviceadmin_1.5.0.v20120610-1946
89 ACTIVE      org.restlet.ext.wadl_2.2.0.snapshot-v20120804-1400
90 ACTIVE      org.restlet.ext.osgi_2.2.0.snapshot-v20120804-1400
91 ACTIVE      org.restlet.ext.xml_2.2.0.snapshot-v20120804-1400
92 ACTIVE      org.restlet.ext.slf4j_2.2.0.snapshot-v20120804-1400
93 ACTIVE      org.restlet_2.2.0.snapshot-v20120804-1400
94 ACTIVE      org.restlet.ext.servlet_2.2.0.snapshot-v20120804-1400
95 ACTIVE      org.restlet.ext.simple_2.2.0.snapshot-v20120804-1400
96 ACTIVE      org.eclipse.ecf.provider.jmdns_4.1.0.v20120610-1946
97 ACTIVE      org.json_1.0.0.v201011060100
98 ACTIVE      org.eclipse.osgi.util_3.2.300.v20120522-1822
99 ACTIVE      javax.xml_1.3.4.v201005080400
osgi> 

The short status (ss) from the OSGi console follows for the consumer:
id State       Bundle
0 ACTIVE      org.eclipse.osgi_3.8.0.v20120529-1548
1 ACTIVE      org.apache.commons.httpclient_3.1.0.v201012070820
2 ACTIVE      org.eclipse.equinox.p2.repository_2.2.0.v20120524-1945
3 ACTIVE      org.eclipse.equinox.console_1.0.0.v20120522-1841
4 ACTIVE      org.eclipse.osgi.services_3.3.100.v20120522-1822
5 ACTIVE      org.apache.commons.codec_1.3.0.v201101211617
6 ACTIVE      org.eclipse.equinox.preferences_3.5.0.v20120522-1841
7 ACTIVE      org.eclipse.equinox.p2.metadata_2.1.0.v20120430-2001
8 ACTIVE      org.apache.felix.gogo.shell_0.8.0.v201110170705
9 ACTIVE      org.restlet_2.2.0.snapshot-v20120804-1400
10 ACTIVE      org.eclipse.equinox.concurrent_1.0.300.v20120522-2049
11 ACTIVE      org.json_1.0.0.v201011060100
12 ACTIVE      org.eclipse.equinox.security_1.1.100.v20120522-1841
            Fragments=41
13 ACTIVE      org.eclipse.equinox.common_3.6.100.v20120522-1841
14 ACTIVE      org.eclipse.ecf.examples.remoteservice.restlet.hello_1.0.0.qualifier
15 ACTIVE      org.eclipse.core.contenttype_3.4.200.v20120523-2004
16 ACTIVE      org.apache.commons.logging_1.0.4.v201101211617
17 RESOLVED    org.eclipse.core.runtime.compatibility.registry_3.5.100.v20120521-2346
            Master=20
18 ACTIVE      org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110808-1657
19 ACTIVE      org.apache.felix.gogo.runtime_0.8.0.v201108120515
20 ACTIVE      org.eclipse.equinox.registry_3.5.200.v20120522-1841
            Fragments=17
21 ACTIVE      javax.servlet_3.0.0.v201112011016
22 ACTIVE      org.eclipse.ant.core_3.2.400.v20120523-1752
23 ACTIVE      org.hamcrest.core_1.1.0.v20090501071000
24 ACTIVE      org.eclipse.core.jobs_3.5.200.v20120521-2346
25 ACTIVE      org.eclipse.equinox.p2.core_2.2.0.v20120430-0525
26 ACTIVE      org.eclipse.ecf.examples.remoteservice.restlet.hello.consumer_1.0.0.qualifier
27 ACTIVE      org.apache.felix.gogo.command_0.8.0.v201108120515
28 ACTIVE      org.apache.ant_1.8.3.v20120321-1730
29 ACTIVE      org.eclipse.core.runtime_3.8.0.v20120521-2346
30 ACTIVE      org.eclipse.core.runtime.compatibility.auth_3.2.300.v20120523-2004
31 ACTIVE      org.eclipse.core.variables_3.2.600.v20120521-2012
32 ACTIVE      org.eclipse.equinox.app_1.3.100.v20120522-1841
33 ACTIVE      org.restlet.ext.servlet_2.2.0.snapshot-v20120804-1400
34 ACTIVE      org.restlet.ext.osgi_2.2.0.snapshot-v20120804-1400
35 ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy_1.0.0.v20120610-1946
36 RESOLVED    org.eclipse.ecf.ssl_1.0.100.v20120610-1946
            Master=46
37 ACTIVE      org.eclipse.ecf.remoteservice.tm.restlet_1.0.0.qualifier
38 ACTIVE      org.eclipse.ecf.identity_3.1.200.v20120610-1946
39 ACTIVE      org.eclipse.ecf.discovery_4.0.0.v20120610-1946
40 ACTIVE      org.eclipse.ecf.provider.restlet_1.0.0.qualifier
41 RESOLVED    org.eclipse.equinox.security.macosx_1.100.200.v20120522-2049
            Master=12
42 ACTIVE      org.eclipse.osgi.services.remoteserviceadmin_1.5.0.v20120610-1946
43 ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin_2.1.0.v20120610-1946
44 ACTIVE      org.eclipse.ecf.remoteservice_6.0.200.v20120610-1946
45 ACTIVE      org.eclipse.ecf.remoteservice.rest_2.2.200.v20120610-1946
46 ACTIVE      org.eclipse.ecf_3.1.300.v20120610-1946
            Fragments=36
47 ACTIVE      org.restlet.ext.xml_2.2.0.snapshot-v20120804-1400
48 ACTIVE      org.restlet.ext.wadl_2.2.0.snapshot-v20120804-1400
49 ACTIVE      org.restlet.ext.simple_2.2.0.snapshot-v20120804-1400
50 ACTIVE      org.eclipse.ecf.provider.jmdns_4.1.0.v20120610-1946
51 ACTIVE      org.eclipse.osgi.util_3.2.300.v20120522-1822
52 ACTIVE      javax.xml_1.3.4.v201005080400
osgi> 

hello.host bundle and services:
osgi> bundle 82
org.eclipse.ecf.examples.remoteservice.restlet.hello.host_1.0.0.qualifier [82]
  Id=82, Status=ACTIVE      Data Root=/Users/mas/dev/tmp.server/.metadata/.plugins/org.eclipse.pde.core/Restlet RSA Server/org.eclipse.osgi/bundles/82/data
  "Registered Services"
    {org.restlet.ext.osgi.IResourceProvider}={component.name=org.eclipse.ecf.examples.remoteservice.restlet.hello, restlet.service.exported.interfaces=[org.eclipse.ecf.examples.remoteservice.restlet.hello.IHelloResource], component.id=3, paths=[/hello], service.id=67}
    {org.restlet.ext.osgi.IRouterProvider}={component.name=org.eclipse.ecf.examples.remoteservice.restlet.app.router, component.id=4, service.id=68}
    {org.restlet.ext.osgi.IApplicationProvider}={alias=/, component.name=org.eclipse.ecf.examples.remoteservice.restlet.app, component.id=2, service.id=69}
  Services in use:
    {org.restlet.ext.osgi.IRouterProvider}={component.name=org.eclipse.ecf.examples.remoteservice.restlet.app.router, component.id=4, service.id=68}
    {org.restlet.ext.osgi.IResourceProvider}={component.name=org.eclipse.ecf.examples.remoteservice.restlet.hello, restlet.service.exported.interfaces=[org.eclipse.ecf.examples.remoteservice.restlet.hello.IHelloResource], component.id=3, paths=[/hello], service.id=67}
  Exported packages
    org.eclipse.ecf.examples.internal.remoteservice.restlet.hello.host; version="0.0.0"[exported]
  Imported packages
    org.eclipse.ecf.examples.remoteservice.restlet.hello; version="0.0.0"<org.eclipse.ecf.examples.remoteservice.restlet.hello_1.0.0.qualifier [85]>
    org.restlet.ext.osgi; version="0.0.0"<org.restlet.ext.osgi_2.2.0.snapshot-v20120804-1400 [90]>
    org.restlet; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.data; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.adapter; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.application; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.component; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.connector; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.converter; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.header; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.internal; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.io; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.local; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.log; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.resource; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.security; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.engine.util; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.representation; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.resource; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.routing; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.security; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.service; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
    org.restlet.util; version="0.0.0"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>
  No fragment bundles
  Named class space
    org.eclipse.ecf.examples.remoteservice.restlet.hello.host; bundle-version="1.0.0.qualifier"[provided]
  Required bundles
    org.restlet; bundle-version="2.2.0.snapshot-v20120804-1400"<org.restlet_2.2.0.snapshot-v20120804-1400 [93]>

Thank you in advance for taking a look.

Kind regards,
-Alan Strait




_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev

_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev


Back to the top