Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Communications Framework (ECF) » ECF problem
ECF problem [message #625213] Wed, 28 April 2010 10:43 Go to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Hello guys,

Since few days im trying to solve my problem and i have no idea why it doesnt work. First of all i want run examples from ECF SDK but changed a little my own way. Ive created two plugins for host and for consumer and copied most of code inside. But my plugins doesnt extend IApplication, just typical plugin extending BundleActivator. My host should register IHello and consumer use it. From what i see service is registerd and in console i got message (source code):

Publish: {org.eclipse.ecf.osgi.services.discovery.ServicePublication} ={osgi.remote.discovery.publication.service.properties={}, ecf.rsvc.ns=ecf.namespace.generic.remoteservice, osgi.remote.service.interfaces=[example.host.IHello], ecf.rsvc.id=[48], ecf.sp.ect=[ecf.generic.server], ecf.sp.cid=StringID[ecftcp://localhost:12345/server], service.id=54} ServiceInfo: ServiceInfo[uri=osgiservices://10.36.7.148:12345 ;id=ServiceID[type=ServiceTypeID[typeName=_osgiservices._tcp .default._iana];location=osgiservices://10.36.7.148:12345;full= _osgiservices._tcp.default._iana@osgiservices://10.36.7.148: 12345 ];priority=0;weight=0;props=ServiceProperties[{ecf.rsvc.ns=e cf.namespace.generic.remoteservice, osgi.remote.service.interfaces=example.host.IHello, ecf.sp.cns=org.eclipse.ecf.core.identity.StringID, ecf.rsvc.id=org.eclipse.ecf.discovery.ServiceProperties$mail to:ByteArrayWrapper@18a8ce2, ecf.sp.ect=ecf.generic.server, ecf.sp.cid=org.eclipse.ecf.discovery.ServiceProperties$mailt o:ByteArrayWrapper@12789d2}]]
hostRegistered
serviceReference={example.host.IHello}={org.eclipse.ecf.cont ainerFactoryArgs=ecftcp://localhost:12345/server, service.exported.configs=ecf.generic.server, service.exported.interfaces=*, service.id=53}
remoteServiceContainer=RemoteServiceContainer [containerID=StringID[ecftcp://localhost:12345/server], container=mailto:org.eclipse.ecf.provider.generic.TCPServerSOContainer@3257b8, containerAdapter=mailto: org.eclipse.ecf.provider.remoteservice.generic.RegistryShare dObject @1343ed0]
remoteRegistration=RemoteServiceRegistrationImpl[remoteServi ceID=org.eclipse.ecf.remoteservice.RemoteServiceID[container ID=StringID[ecftcp://localhost:12345/server];containerRelativeID=0];containerID=StringID[ecftcp://localhost:12345/server ];serviceid=0;serviceranking=0;classes=[example.host.IHello] ;state=0;properties={ecf.rsvc.id=0}]
Host: Hello Service Registered

I guess everything is fine on host side but nothing happens on client side. I got only:

Start consumer
Finish activator

No service is discovered. Why? What is wrong? I will be gratefull for help and ideas.

Maybe it will be useful if i give you also bundles list installed with consumer:

id State Bundle
0 ACTIVE org.eclipse.osgi_3.5.2.R35x_v20100126
1 ACTIVE org.eclipse.ecf.provider.remoteservice_3.2.0.v20100219-1253
2 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
3 ACTIVE org.eclipse.ecf_3.1.0.v20100219-1253
Fragments=33
4 ACTIVE org.eclipse.ecf.sharedobject_2.1.0.v20100219-1253
6 ACTIVE com.springsource.net.sf.cglib_2.1.3
7 ACTIVE org.eclipse.ecf.discovery_3.0.0.v20100219-1253
8 ACTIVE org.eclipse.ecf.provider_3.0.0.v20100219-1253
9 ACTIVE org.springframework.context_2.5.6.SEC01
10 ACTIVE org.springframework.beans_2.5.6.SEC01
11 ACTIVE org.springframework.osgi.core_1.2.1
12 ACTIVE org.eclipse.ecf.identity_3.1.0.v20100219-1253
13 ACTIVE org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
14 RESOLVED com.springsource.slf4j.log4j_1.5.0
Master=20
15 ACTIVE org.eclipse.equinox.app_1.2.1.R35x_v20091203
16 ACTIVE org.springframework.osgi.mock_1.2.1
17 ACTIVE org.eclipse.ecf.remoteservice_4.0.0.v20100219-1253
19 ACTIVE org.springframework.aop_2.5.6.SEC01
20 ACTIVE com.springsource.slf4j.api_1.5.0
Fragments=14
21 ACTIVE org.eclipse.ecf.provider.jmdns_4.0.0.v20100219-1253
22 ACTIVE com.springsource.junit_3.8.2
23 ACTIVE org.eclipse.equinox.preferences_3.2.301.R35x_v20091117
24 ACTIVE com.springsource.slf4j.org.apache.commons.logging_1.5.0
25 ACTIVE org.eclipse.core.runtime_3.5.0.v20090525
26 ACTIVE org.springframework.core_2.5.6.SEC01
27 ACTIVE org.eclipse.ecf.osgi.services.distribution_1.1.0.v20100219-1 253
28 ACTIVE com.springsource.org.aopalliance_1.0.0
29 ACTIVE org.eclipse.ecf.osgi.services.discovery_1.1.0.v20100219-1253
30 ACTIVE com.springsource.edu.emory.mathcs.backport_3.1.0
31 ACTIVE org.springframework.osgi.extender_1.2.1
32 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
33 RESOLVED org.eclipse.ecf.ssl_1.0.0.v20100219-1253
Master=3
34 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
35 ACTIVE com.springsource.org.objectweb.asm_2.2.3
36 ACTIVE org.springframework.osgi.io_1.2.1
37 ACTIVE org.springframework.test_2.5.6.SEC01
38 ACTIVE org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
39 ACTIVE org.eclipse.core.contenttype_3.4.1.R35x_v20090826-0451
40 ACTIVE org.eclipse.equinox.concurrent_1.0.1.R35x_v20100209
41 RESOLVED org.springframework.osgi.test_1.2.1
43 ACTIVE example.consumer_1.0.0.qualifier
44 RESOLVED example.host_1.0.0.qualifier
45 ACTIVE org.eclipse.ecf.osgi.services.discovery.local_1.0.0.v2010021 9-1253



Part of host Source:

private static final String DEFAULT_CONTAINER_TYPE = "ecf.generic.server";
public static final String DEFAULT_CONTAINER_ID = "ecftcp://localhost:12345/server";

private BundleContext bundleContext;

private String containerType = DEFAULT_CONTAINER_TYPE;
private String containerId = DEFAULT_CONTAINER_ID;

private final Object appLock = new Object();
private boolean done = false;

private ServiceRegistration helloRegistration;
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework. BundleContext
* )
*/

public void registered(ServiceReference serviceReference,
IRemoteServiceContainer remoteServiceContainer, IRemoteServiceRegistration remoteRegistration) {
System.out.println("hostRegistered\n\tserviceReference="+serviceReference+ "\n\tremoteServiceContainer="+remoteServiceContainer+"\n\tremoteRegistration= "+remoteRegistration);
}

public void unregistered(ServiceReference serviceReference, IRemoteServiceRegistration remoteRegistration) {
System.out.println("hostUnregistered\n\tserviceReference="+serviceReference+ "\n\tremoteRegistration="+remoteRegistration);
}

public void publish(ServiceReference arg0, IServiceInfo arg1){
System.out.println("Publish: "+arg0+" ServiceInfo: "+arg1);
}

public void unpublish(ServiceReference arg0, IServiceInfo arg1){
System.out.println("Unpublish: "+arg0+" ServiceInfo: "+arg1);
}

public void start(BundleContext ctxt) throws Exception {
context = ctxt;

//ContainerFactory.getDefault().createContainer("ecf.generic.server ");

Properties props = new Properties();
// add OSGi service property indicated export of all interfaces exposed by service (wildcard)
props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES , IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD) ;
// add OSGi service property specifying config
props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, containerType);
// add ECF service property specifying container factory args
props.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_ FACTORY_ARGUMENTS, containerId);
// register remote service

context.registerService(IHostDistributionListener.class.getN ame(),this,null);
context.registerService(IHostDiscoveryListener.class.getName (),this,null);

helloRegistration = context.registerService(IHello.class.getName(), new Hello(), props);
// tell everyone
System.out.println("Host: Hello Service Registered");
}


Part of consumer code:

public static final String CONSUMER_NAME = "example.consumer";

private BundleContext bundleContext;
private ServiceTracker containerFactoryServiceTracker;

private String containerType = "ecf.generic.client";

private final Object appLock = new Object();
private boolean done = false;

private ServiceTracker helloServiceTracker;


public void discovered(IServiceInfo arg0){
System.out.println("Service discovery: "+arg0);
}


public void undiscovered(IServiceInfo arg0){
System.out.println("Service discovery: "+arg0);

}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework. BundleContext)
*/
public void start(BundleContext context) throws Exception {
System.out.println("Start consumer");

bundleContext = context;

IContainerFactory cf = getContainerFactory();

IContainer container = cf.createContainer(containerType);
ID targetID = IDFactory.getDefault().createStringID("ecftcp://localhost:12345/server");
container.connect(targetID, null);

bundleContext.registerService(IProxyDiscoveryListener.class. getName(),this,null);
bundleContext.registerService(IProxyDistributionListener.cla ss.getName(),this,null);

// Create service tracker to track IHello instances that have the 'service.imported'
// property set (as defined by OSGi 4.2 remote services spec).
helloServiceTracker = new ServiceTracker(bundleContext, createRemoteFilter(), this);
helloServiceTracker.open();

startLocalDiscoveryIfPresent();

System.out.println("Finish activator");
}

private void startLocalDiscoveryIfPresent() {
Bundle[] bundles = bundleContext.getBundles();
for(int i=0; i < bundles.length; i++) {
if (bundles[i].getSymbolicName().equals("org.eclipse.ecf.osgi.services.discovery.local ")) {
try {
bundles[i].start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Re: ECF problem [message #625214 is a reply to message #625213] Wed, 28 April 2010 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: news.eclipse.org.08.lemmster.de

On 04/28/2010 12:43 PM, kith1985@o2.pl wrote:

> No service is discovered. Why? What is wrong? I will be gratefull for
> help and ideas.
>
> Maybe it will be useful if i give you also bundles list installed with
> consumer:
>
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.5.2.R35x_v20100126
> 1 ACTIVE
> org.eclipse.ecf.provider.remoteservice_3.2.0.v20100219-1253
> 2 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
> 3 ACTIVE org.eclipse.ecf_3.1.0.v20100219-1253
> Fragments=33
> 4 ACTIVE org.eclipse.ecf.sharedobject_2.1.0.v20100219-1253
> 6 ACTIVE com.springsource.net.sf.cglib_2.1.3
> 7 ACTIVE org.eclipse.ecf.discovery_3.0.0.v20100219-1253
> 8 ACTIVE org.eclipse.ecf.provider_3.0.0.v20100219-1253
> 9 ACTIVE org.springframework.context_2.5.6.SEC01
> 10 ACTIVE org.springframework.beans_2.5.6.SEC01
> 11 ACTIVE org.springframework.osgi.core_1.2.1
> 12 ACTIVE org.eclipse.ecf.identity_3.1.0.v20100219-1253
> 13 ACTIVE org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
> 14 RESOLVED com.springsource.slf4j.log4j_1.5.0
> Master=20
> 15 ACTIVE org.eclipse.equinox.app_1.2.1.R35x_v20091203
> 16 ACTIVE org.springframework.osgi.mock_1.2.1
> 17 ACTIVE org.eclipse.ecf.remoteservice_4.0.0.v20100219-1253
> 19 ACTIVE org.springframework.aop_2.5.6.SEC01
> 20 ACTIVE com.springsource.slf4j.api_1.5.0
> Fragments=14
> 21 ACTIVE org.eclipse.ecf.provider.jmdns_4.0.0.v20100219-1253
> 22 ACTIVE com.springsource.junit_3.8.2
> 23 ACTIVE org.eclipse.equinox.preferences_3.2.301.R35x_v20091117
> 24 ACTIVE com.springsource.slf4j.org.apache.commons.logging_1.5.0
> 25 ACTIVE org.eclipse.core.runtime_3.5.0.v20090525
> 26 ACTIVE org.springframework.core_2.5.6.SEC01
> 27 ACTIVE
> org.eclipse.ecf.osgi.services.distribution_1.1.0.v20100219-1 253
> 28 ACTIVE com.springsource.org.aopalliance_1.0.0
> 29 ACTIVE
> org.eclipse.ecf.osgi.services.discovery_1.1.0.v20100219-1253
> 30 ACTIVE com.springsource.edu.emory.mathcs.backport_3.1.0
> 31 ACTIVE org.springframework.osgi.extender_1.2.1
> 32 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
> 33 RESOLVED org.eclipse.ecf.ssl_1.0.0.v20100219-1253
> Master=3
> 34 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
> 35 ACTIVE com.springsource.org.objectweb.asm_2.2.3
> 36 ACTIVE org.springframework.osgi.io_1.2.1
> 37 ACTIVE org.springframework.test_2.5.6.SEC01
> 38 ACTIVE org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
> 39 ACTIVE org.eclipse.core.contenttype_3.4.1.R35x_v20090826-0451
> 40 ACTIVE org.eclipse.equinox.concurrent_1.0.1.R35x_v20100209
> 41 RESOLVED org.springframework.osgi.test_1.2.1
> 43 ACTIVE example.consumer_1.0.0.qualifier
> 44 RESOLVED example.host_1.0.0.qualifier
> 45 ACTIVE
> org.eclipse.ecf.osgi.services.discovery.local_1.0.0.v2010021 9-1253

Hi,

do you also have the org.eclipse.ecf.provider.jmdns deployed and active
on the host side?

Markus
Re: ECF problem [message #625215 is a reply to message #625213] Wed, 28 April 2010 13:41 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
Yes, i have got - ID 21 in the list.
Re: ECF problem [message #625216 is a reply to message #625215] Wed, 28 April 2010 14:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: news.eclipse.org.08.lemmster.de

On 04/28/2010 03:41 PM, kith1985@o2.pl wrote:
> Yes, i have got - ID 21 in the list.

You wrote that the bundle list originates from the client/consumer side.
In essence though, you have to make sure that the same discovery
provider (jmdns in your case) is deployed and active on both sides (host
and consumer). Also both sides have to be on the same subnet, as at
least jmdns, zookeeper as well as slp are all limited to multicast
discovery.

Markus
Re: ECF problem [message #625217 is a reply to message #625213] Wed, 28 April 2010 15:45 Go to previous messageGo to next message
Scott Lewis is currently offline Scott LewisFriend
Messages: 1038
Registered: July 2009
Senior Member
Hi,

One way to get an idea of the necessary bundles for using various
discovery providers is to look at the list of bundles in the product
configurations for the hello example host and consumer.

i.e. in the consumer and host projects there is a products directory
with several product configurations:

<project root>/products/*.product

Inside these product configurations is a list of bundles/plugins...this
includes the necessary bundles for using the various discovery approaches.

Scott



kith1985@o2.pl wrote:
> Hello guys,
>
> Since few days im trying to solve my problem and i have no idea why it
> doesnt work. First of all i want run examples from ECF SDK but changed a
> little my own way. Ive created two plugins for host and for consumer and
> copied most of code inside. But my plugins doesnt extend IApplication,
> just typical plugin extending BundleActivator. My host should register
> IHello and consumer use it. From what i see service is registerd and in
> console i got message (source code):
>
> Publish: {org.eclipse.ecf.osgi.services.discovery.ServicePublication}
> ={osgi.remote.discovery.publication.service.properties={},
> ecf.rsvc.ns=ecf.namespace.generic.remoteservice,
> osgi.remote.service.interfaces=[example.host.IHello], ecf.rsvc.id=[48],
> ecf.sp.ect=[ecf.generic.server],
> ecf.sp.cid=StringID[ecftcp://localhost:12345/server], service.id=54}
> ServiceInfo: ServiceInfo[uri=osgiservices://10.36.7.148:12345
> ;id=ServiceID[type=ServiceTypeID[typeName=_osgiservices._tcp
> .default._iana];location=osgiservices://10.36.7.148:12345;full= _osgiservices._tcp.default._iana@osgiservices://10.36.7.148: 12345
> ];priority=0;weight=0;props=ServiceProperties[{ecf.rsvc.ns=e
> cf.namespace.generic.remoteservice,
> osgi.remote.service.interfaces=example.host.IHello,
> ecf.sp.cns=org.eclipse.ecf.core.identity.StringID,
> ecf.rsvc.id=org.eclipse.ecf.discovery.ServiceProperties$mail to:ByteArrayWrapper@18a8ce2,
> ecf.sp.ect=ecf.generic.server,
> ecf.sp.cid=org.eclipse.ecf.discovery.ServiceProperties$mailt o:ByteArrayWrapper@12789d2}]]
>
> hostRegistered
> serviceReference={example.host.IHello}={org.eclipse.ecf.cont
> ainerFactoryArgs=ecftcp://localhost:12345/server,
> service.exported.configs=ecf.generic.server,
> service.exported.interfaces=*, service.id=53}
> remoteServiceContainer=RemoteServiceContainer
> [containerID=StringID[ecftcp://localhost:12345/server],
> container=mailto:org.eclipse.ecf.provider.generic.TCPServerSOContainer@3257b8,
> containerAdapter=mailto: org.eclipse.ecf.provider.remoteservice.generic.RegistryShare dObject @1343ed0]
>
> remoteRegistration=RemoteServiceRegistrationImpl[remoteServi
> ceID=org.eclipse.ecf.remoteservice.RemoteServiceID[container
> ID=StringID[ecftcp://localhost:12345/server];containerRelativeID=0];containerID=StringID[ecftcp://localhost:12345/server
> ];serviceid=0;serviceranking=0;classes=[example.host.IHello]
> ;state=0;properties={ecf.rsvc.id=0}]
> Host: Hello Service Registered
>
> I guess everything is fine on host side but nothing happens on client
> side. I got only:
>
> Start consumer
> Finish activator
>
> No service is discovered. Why? What is wrong? I will be gratefull for
> help and ideas.
>
> Maybe it will be useful if i give you also bundles list installed with
> consumer:
>
> id State Bundle
> 0 ACTIVE org.eclipse.osgi_3.5.2.R35x_v20100126
> 1 ACTIVE
> org.eclipse.ecf.provider.remoteservice_3.2.0.v20100219-1253
> 2 ACTIVE org.eclipse.equinox.registry_3.4.100.v20090520-1800
> 3 ACTIVE org.eclipse.ecf_3.1.0.v20100219-1253
> Fragments=33
> 4 ACTIVE org.eclipse.ecf.sharedobject_2.1.0.v20100219-1253
> 6 ACTIVE com.springsource.net.sf.cglib_2.1.3
> 7 ACTIVE org.eclipse.ecf.discovery_3.0.0.v20100219-1253
> 8 ACTIVE org.eclipse.ecf.provider_3.0.0.v20100219-1253
> 9 ACTIVE org.springframework.context_2.5.6.SEC01
> 10 ACTIVE org.springframework.beans_2.5.6.SEC01
> 11 ACTIVE org.springframework.osgi.core_1.2.1
> 12 ACTIVE org.eclipse.ecf.identity_3.1.0.v20100219-1253
> 13 ACTIVE org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100
> 14 RESOLVED com.springsource.slf4j.log4j_1.5.0
> Master=20
> 15 ACTIVE org.eclipse.equinox.app_1.2.1.R35x_v20091203
> 16 ACTIVE org.springframework.osgi.mock_1.2.1
> 17 ACTIVE org.eclipse.ecf.remoteservice_4.0.0.v20100219-1253
> 19 ACTIVE org.springframework.aop_2.5.6.SEC01
> 20 ACTIVE com.springsource.slf4j.api_1.5.0
> Fragments=14
> 21 ACTIVE org.eclipse.ecf.provider.jmdns_4.0.0.v20100219-1253
> 22 ACTIVE com.springsource.junit_3.8.2
> 23 ACTIVE org.eclipse.equinox.preferences_3.2.301.R35x_v20091117
> 24 ACTIVE com.springsource.slf4j.org.apache.commons.logging_1.5.0
> 25 ACTIVE org.eclipse.core.runtime_3.5.0.v20090525
> 26 ACTIVE org.springframework.core_2.5.6.SEC01
> 27 ACTIVE
> org.eclipse.ecf.osgi.services.distribution_1.1.0.v20100219-1 253
> 28 ACTIVE com.springsource.org.aopalliance_1.0.0
> 29 ACTIVE
> org.eclipse.ecf.osgi.services.discovery_1.1.0.v20100219-1253
> 30 ACTIVE com.springsource.edu.emory.mathcs.backport_3.1.0
> 31 ACTIVE org.springframework.osgi.extender_1.2.1
> 32 ACTIVE org.eclipse.osgi.services_3.2.0.v20090520-1800
> 33 RESOLVED org.eclipse.ecf.ssl_1.0.0.v20100219-1253
> Master=3
> 34 ACTIVE org.eclipse.core.jobs_3.4.100.v20090429-1800
> 35 ACTIVE com.springsource.org.objectweb.asm_2.2.3
> 36 ACTIVE org.springframework.osgi.io_1.2.1
> 37 ACTIVE org.springframework.test_2.5.6.SEC01
> 38 ACTIVE org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
> 39 ACTIVE org.eclipse.core.contenttype_3.4.1.R35x_v20090826-0451
> 40 ACTIVE org.eclipse.equinox.concurrent_1.0.1.R35x_v20100209
> 41 RESOLVED org.springframework.osgi.test_1.2.1
> 43 ACTIVE example.consumer_1.0.0.qualifier
> 44 RESOLVED example.host_1.0.0.qualifier
> 45 ACTIVE
> org.eclipse.ecf.osgi.services.discovery.local_1.0.0.v2010021 9-1253
>
>
>
> Part of host Source:
>
> private static final String DEFAULT_CONTAINER_TYPE =
> "ecf.generic.server";
> public static final String DEFAULT_CONTAINER_ID =
> "ecftcp://localhost:12345/server";
>
> private BundleContext bundleContext;
>
> private String containerType = DEFAULT_CONTAINER_TYPE;
> private String containerId = DEFAULT_CONTAINER_ID;
>
> private final Object appLock = new Object();
> private boolean done = false;
>
> private ServiceRegistration helloRegistration;
> /*
> * (non-Javadoc)
> * * @see
> * org.osgi.framework.BundleActivator#start(org.osgi.framework.
> BundleContext
> * )
> */
>
> public void registered(ServiceReference serviceReference,
> IRemoteServiceContainer remoteServiceContainer,
> IRemoteServiceRegistration remoteRegistration) {
>
> System.out.println("hostRegistered\n\tserviceReference="+serviceReference+
> "\n\tremoteServiceContainer="+remoteServiceContainer+"\n\tremoteRegistration=
> "+remoteRegistration);
> }
> public void unregistered(ServiceReference serviceReference,
> IRemoteServiceRegistration remoteRegistration) {
>
> System.out.println("hostUnregistered\n\tserviceReference="+serviceReference+
> "\n\tremoteRegistration="+remoteRegistration);
> }
> public void publish(ServiceReference arg0, IServiceInfo arg1){
> System.out.println("Publish: "+arg0+" ServiceInfo: "+arg1);
> }
> public void unpublish(ServiceReference arg0, IServiceInfo
> arg1){
> System.out.println("Unpublish: "+arg0+" ServiceInfo: "+arg1);
> }
>
> public void start(BundleContext ctxt) throws Exception {
> context = ctxt;
>
>
> //ContainerFactory.getDefault().createContainer("ecf.generic.server ");
>
> Properties props = new Properties();
> // add OSGi service property indicated export of all interfaces
> exposed by service (wildcard)
> props.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES ,
> IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD) ;
> // add OSGi service property specifying config
> props.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS,
> containerType);
> // add ECF service property specifying container factory args
> props.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_
> FACTORY_ARGUMENTS, containerId);
> // register remote service
>
> context.registerService(IHostDistributionListener.class.getN
> ame(),this,null);
> context.registerService(IHostDiscoveryListener.class.getName
> (),this,null);
>
> helloRegistration =
> context.registerService(IHello.class.getName(), new Hello(), props);
> // tell everyone
> System.out.println("Host: Hello Service Registered");
> }
>
>
> Part of consumer code:
>
> public static final String CONSUMER_NAME = "example.consumer";
>
> private BundleContext bundleContext;
> private ServiceTracker containerFactoryServiceTracker;
>
> private String containerType = "ecf.generic.client";
>
> private final Object appLock = new Object();
> private boolean done = false;
>
> private ServiceTracker helloServiceTracker;
>
>
> public void discovered(IServiceInfo arg0){
> System.out.println("Service discovery: "+arg0);
> }
>
> public void undiscovered(IServiceInfo arg0){
> System.out.println("Service discovery: "+arg0);
> }
> /*
> * (non-Javadoc)
> * @see
> org.osgi.framework.BundleActivator#start(org.osgi.framework. BundleContext)
> */
> public void start(BundleContext context) throws Exception {
> System.out.println("Start consumer");
>
> bundleContext = context;
>
> IContainerFactory cf = getContainerFactory();
>
> IContainer container = cf.createContainer(containerType);
> ID targetID =
> IDFactory.getDefault().createStringID("ecftcp://localhost:12345/server");
> container.connect(targetID, null);
>
> bundleContext.registerService(IProxyDiscoveryListener.class.
> getName(),this,null);
> bundleContext.registerService(IProxyDistributionListener.cla
> ss.getName(),this,null);
>
> // Create service tracker to track IHello instances that have
> the 'service.imported'
> // property set (as defined by OSGi 4.2 remote services spec).
> helloServiceTracker = new ServiceTracker(bundleContext,
> createRemoteFilter(), this);
> helloServiceTracker.open();
>
> startLocalDiscoveryIfPresent();
>
> System.out.println("Finish activator");
> }
>
> private void startLocalDiscoveryIfPresent() {
> Bundle[] bundles = bundleContext.getBundles();
> for(int i=0; i < bundles.length; i++) {
> if
> (bundles[i].getSymbolicName().equals("org.eclipse.ecf.osgi.services.discovery.local
> ")) {
> try {
> bundles[i].start();
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> }
Re: ECF problem [message #625218 is a reply to message #625213] Wed, 28 April 2010 18:41 Go to previous message
No real name is currently offline No real nameFriend
Messages: 18
Registered: April 2010
Junior Member
First - my run configuration is the same on host and consumer
Second - all bundles are active and no errors during start.
Third - i try it worked on localhost as you see so there is no case of different subnet or network problem
Forth - list of bundles which i installed are taken from ECF website and also ive verified it with taget configuration from SDK example

Since now nothing helps. I tried many ways but nothing happens and i have completly no idea how to make it works.
Previous Topic:remote services, load balancing
Next Topic:Using a jdbc database as backend storage
Goto Forum:
  


Current Time: Fri Apr 26 19:36:57 GMT 2024

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

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

Back to the top