Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Communications Framework (ECF) » Why the remote service reference could not be obtained using an edef xml file?(Trouble with obtaining a remote referece using an edef file)
Why the remote service reference could not be obtained using an edef xml file? [message #714804] Thu, 11 August 2011 10:27 Go to next message
Marton Sigmond is currently offline Marton Sigmond
Messages: 71
Registered: July 2009
Location: Hungary
Member
Hi,

please help me figure out why the remote service reference could not be obtained using an edef xml file.

I put the following service interface into the 'remote.service' bundle:
package remote.service;
public interface IEchoService {
    String echo(String input);
}

Then I created an implementation in the 'remote.service.provider' bundle, and registered it declaratively:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="remote.service.provider">
   <implementation class="remote.service.provider.EchoService"/>
   <service>
      <provide interface="remote.service.IEchoService"/>
   </service>
   <property name="service.exported.interfaces" type="String" value="*"/>
   <property name="service.exported.configs" type="String" value="ecf.generic.server"/>
   <property name="ecf.exported.containerfactoryargs" type="String" value="ecftcp://localhost:3787/server"/>
</scr:component>

Then I deployed them on a linux box:
osgi> ss

Framework is launched.

id      State       Bundle
0       ACTIVE      org.eclipse.osgi_3.7.0.v20110613
                    Fragments=5
1       ACTIVE      org.eclipse.equinox.common_3.6.0.v20110523
2       ACTIVE      org.eclipse.update.configurator_3.3.100.v20100512
3       RESOLVED    org.eclipse.core.runtime.compatibility.registry_3.5.0.v20110505
                    Master=26
4       ACTIVE      javax.servlet_2.5.0.v201103041518
5       RESOLVED    javax.transaction_1.1.1.v201105210645
                    Master=0
6       ACTIVE      org.eclipse.core.contenttype_3.4.100.v20110423-0524
7       ACTIVE      org.eclipse.core.jobs_3.5.100.v20110404
8       ACTIVE      org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110
9       ACTIVE      org.eclipse.core.runtime_3.7.0.v20110110
10      ACTIVE      org.eclipse.ecf.discovery_4.0.0.v20110531-2218
11      ACTIVE      org.eclipse.ecf.identity_3.1.100.v20110531-2218
12      ACTIVE      org.eclipse.ecf.osgi.services.distribution_2.0.100.v20110531-2218
13      ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy_1.0.0.v20110531-2218
14      ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin_2.0.100.v20110531-2218
15      ACTIVE      org.eclipse.ecf.provider.jmdns_4.1.0.v20110531-2218
16      ACTIVE      org.eclipse.ecf.provider.remoteservice_4.0.0.v20110531-2218
17      ACTIVE      org.eclipse.ecf.provider_4.2.0.v20110531-2218
18      ACTIVE      org.eclipse.ecf.remoteservice_6.0.0.v20110531-2218
19      ACTIVE      org.eclipse.ecf.sharedobject_2.2.100.v20110531-2218
20      RESOLVED    org.eclipse.ecf.ssl_1.0.100.v20110531-2218
                    Master=21
21      ACTIVE      org.eclipse.ecf_3.1.300.v20110531-2218
                    Fragments=20
22      ACTIVE      org.eclipse.equinox.app_1.3.100.v20110321
23      ACTIVE      org.eclipse.equinox.concurrent_1.0.100.v20100503
24      ACTIVE      org.eclipse.equinox.ds_1.3.0.v20110502
25      ACTIVE      org.eclipse.equinox.preferences_3.4.0.v20110502
26      ACTIVE      org.eclipse.equinox.registry_3.5.100.v20110502
                    Fragments=3
27      ACTIVE      org.eclipse.equinox.util_1.0.300.v20110502
28      ACTIVE      org.eclipse.osgi.services.remoteserviceadmin_1.0.0.v20110518-0228
29      ACTIVE      org.eclipse.osgi.services_3.3.0.v20110513
30      ACTIVE      remote.service.provider_1.0.0.201108051748
31      RESOLVED    remote.service_1.0.0

osgi> services (objectClass=*EchoService)
{remote.service.IEchoService}={ecf.exported.containerfactoryargs=ecftcp://localhost:3787/server, component.name=remote.service.provider, component.id=1, service.exported.configs=ecf.generic.server, service.exported.interfaces=*, service.id=61}
  Registered by bundle: remote.service.provider_1.0.0.201108051748 [30]
  Bundles using service:
    org.eclipse.ecf.osgi.services.distribution_2.0.100.v20110531-2218 [12]

I registered a consumer declaratively in the 'remote.service.consumer' bundle:
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="remote.service.consumer">
   <implementation class="remote.service.consumer.EchoServiceConsumer"/>
   <reference bind="registerService" cardinality="0..1" interface="remote.service.IEchoService" name="IEchoService" policy="dynamic" unbind="unregisterService"/>
</scr:component>

Finally I created a bundle named 'remote.service.discover.edef' with the following edef file inside:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
  <endpoint-description>
    <property name="endpoint.id" value-type="String" value="ecftcp://thelinuxbox:3787/server"/>
    <property name="endpoint.package.version.remote.service" value-type="String" value="1.0.0"/>
    <property name="objectClass" value-type="String">
      <array>
        <value>remote.service.IEchoService</value>
      </array>
    </property>
    <property name="service.imported.configs" value-type="String">
      <array>
        <value>ecf.generic.server</value>
      </array>
    </property>
  </endpoint-description>
</endpoint-descriptions>

My client deployment on WinXP 32bit running inside Eclipse Indigo:
id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.7.0.v20110613
	            Fragments=27
1	ACTIVE      org.eclipse.ecf.provider.jmdns_4.1.0.v20110531-2218
2	ACTIVE      org.eclipse.ecf.provider_4.2.0.v20110531-2218
3	ACTIVE      org.eclipse.ecf.sharedobject_2.2.100.v20110531-2218
4	ACTIVE      org.eclipse.core.jobs_3.5.100.v20110404
5	ACTIVE      org.eclipse.equinox.util_1.0.300.v20110502
6	ACTIVE      org.eclipse.osgi.services_3.3.0.v20110513
7	ACTIVE      org.eclipse.equinox.app_1.3.100.v20110321
8	RESOLVED    org.eclipse.ecf.ssl_1.0.100.v20110531-2218
	            Master=22
9	ACTIVE      org.eclipse.equinox.concurrent_1.0.100.v20100503
10	ACTIVE      org.eclipse.core.runtime_3.7.0.v20110110
11	ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin.proxy_1.0.0.v20110531-2218
12	ACTIVE      org.eclipse.ecf.osgi.services.remoteserviceadmin_2.0.100.v20110531-2218
13	ACTIVE      org.eclipse.equinox.common_3.6.0.v20110523
14	ACTIVE      org.eclipse.osgi.services.remoteserviceadmin_1.0.0.v20110518-0228
15	ACTIVE      org.eclipse.ecf.remoteservice_6.0.0.v20110531-2218
16	ACTIVE      org.eclipse.core.contenttype_3.4.100.v20110423-0524
17	ACTIVE      org.eclipse.equinox.registry_3.5.100.v20110502
	            Fragments=23
18	ACTIVE      javax.servlet_2.5.0.v201103041518
19	ACTIVE      org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110
20	ACTIVE      remote.service_1.0.0
21	ACTIVE      org.eclipse.ecf.provider.remoteservice_4.0.0.v20110531-2218
22	ACTIVE      org.eclipse.ecf_3.1.300.v20110531-2218
	            Fragments=8
23	RESOLVED    org.eclipse.core.runtime.compatibility.registry_3.5.0.v20110505
	            Master=17
24	RESOLVED    remote.service.discover.edef_1.0.0.qualifier
25	ACTIVE      org.eclipse.equinox.preferences_3.4.0.v20110502
26	ACTIVE      org.eclipse.ecf.identity_3.1.100.v20110531-2218
27	RESOLVED    javax.transaction_1.1.1.v201105210645
	            Master=0
28	ACTIVE      org.eclipse.ecf.discovery_4.0.0.v20110531-2218
29	ACTIVE      remote.service.consumer_1.0.0.qualifier
30	ACTIVE      org.eclipse.ecf.osgi.services.distribution_2.0.100.v20110531-2218
31	ACTIVE      org.eclipse.equinox.ds_1.3.0.v20110502

When I start the 'remote.service.discover.edef' bundle I get the following exception:
RemoteReferenceNotFoundException[targetID=StringID[ecftcp://thelinuxbox:3787/server], idFilter=[StringID[ecftcp://thelinuxbox:3787/server]], interfaces=[remote.service.IEchoService], rsFilter=null]
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:1984)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:356)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager.handleEndpointAdded(AbstractTopologyManager.java:225)
	at org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManager.endpointAdded(BasicTopologyManager.java:77)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator$1.dispatchEvent(EndpointDescriptionLocator.java:154)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

If the server is down, I get this though:
org.eclipse.ecf.core.ContainerConnectException: Exception during connection to ecftcp://thelinuxbox:3787/server
	at org.eclipse.ecf.provider.generic.ClientSOContainer.connect(ClientSOContainer.java:175)
	at org.eclipse.ecf.provider.generic.SOContext.connect(SOContext.java:112)
	at org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject.connectToRemoteServiceTarget(RegistrySharedObject.java:558)
	at org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject.getRemoteServiceReferences(RegistrySharedObject.java:139)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:1966)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:356)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager.handleEndpointAdded(AbstractTopologyManager.java:225)
	at org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManager.endpointAdded(BasicTopologyManager.java:77)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator$1.dispatchEvent(EndpointDescriptionLocator.java:154)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at java.net.Socket.connect(Socket.java:519)
	at org.eclipse.ecf.provider.comm.tcp.SocketFactory.createSocket(SocketFactory.java:26)
	at org.eclipse.ecf.provider.comm.tcp.Client.connect(Client.java:183)
	at org.eclipse.ecf.provider.generic.ClientSOContainer.connect(ClientSOContainer.java:145)
	... 10 more

I am new to remote services and ECF, please let me know what am I doing wrong.

Thanks,
Marton


Best Regards,
Marton Sigmond
Software Design Engineer
Re: Why the remote service reference could not be obtained using an edef xml file? [message #715149 is a reply to message #714804] Fri, 12 August 2011 10:38 Go to previous messageGo to next message
Marton Sigmond is currently offline Marton Sigmond
Messages: 71
Registered: July 2009
Location: Hungary
Member
Hi,

I could make it work with r-OSGi (instead of generic server).
However when the remote service is resolved I get the following exception:
java.lang.NullPointerException
	at java.util.Hashtable.put(Hashtable.java:394)
	at org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.PropertiesUtil.createDictionaryFromMap(PropertiesUtil.java:275)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.createAndRegisterProxy(RemoteServiceAdmin.java:1516)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:1987)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:356)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager.handleEndpointAdded(AbstractTopologyManager.java:225)
	at org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManager.endpointAdded(BasicTopologyManager.java:77)
	at org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator$1.dispatchEvent(EndpointDescriptionLocator.java:154)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

and then this:
java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at java.net.SocketInputStream.read(SocketInputStream.java:182)
	at java.io.DataInputStream.readByte(DataInputStream.java:248)
	at ch.ethz.iks.slp.impl.SLPMessage.parse(SLPMessage.java:238)
	at ch.ethz.iks.slp.impl.SLPCore.sendMessageTCP(SLPCore.java:671)
	at ch.ethz.iks.slp.impl.SLPCore$2.run(SLPCore.java:980)

(NOTE: These exceptions are visible in the Eclipse IDE only - they don't show up in standalone deployment.)

Could you please advice why I get these exceptions and how could I avoid them?

Also, the original question is still open: why this thing did not work with a generic server?

I appreciate your help.
Marton


Best Regards,
Marton Sigmond
Software Design Engineer
(no subject) [message #715592 is a reply to message #715149] Sun, 14 August 2011 13:27 Go to previous message
Wim Jongman is currently offline Wim Jongman
Messages: 418
Registered: July 2009
Senior Member
Hi Martin,

Please take this discussion to the mailing list.

Best regards,

Wim Jongman


> Hi,
>
> I could make it work with r-OSGi (instead of generic server).
> However when the remote service is resolved I get the following exception:
> java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:394)
> at
org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.PropertiesUtil.createDictionaryFromMap(PropertiesUtil.java:275)
> at
org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.createAndRegisterProxy(RemoteServiceAdmin.java:1516)
> at
org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:1987)
> at
org.eclipse.ecf.osgi.services.remoteserviceadmin.RemoteServiceAdmin.importService(RemoteServiceAdmin.java:356)
> at
org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager.handleEndpointAdded(AbstractTopologyManager.java:225)
> at
org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManager.endpointAdded(BasicTopologyManager.java:77)
> at
org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator$1.dispatchEvent(EndpointDescriptionLocator.java:154)
> at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
> at
org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
> and then this:
> java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
> at java.net.SocketInputStream.read(SocketInputStream.java:129)
> at java.net.SocketInputStream.read(SocketInputStream.java:182)
> at java.io.DataInputStream.readByte(DataInputStream.java:248)
> at ch.ethz.iks.slp.impl.SLPMessage.parse(SLPMessage.java:238)
> at ch.ethz.iks.slp.impl.SLPCore.sendMessageTCP(SLPCore.java:671)
> at ch.ethz.iks.slp.impl.SLPCore$2.run(SLPCore.java:980)
> (NOTE: These exceptions are visible in the Eclipse IDE only - they don't
show up in standalone deployment.)
>
> Could you please advice why I get these exceptions and how could I avoid
them?
>
> Also, the original question is still open: why this thing did not work with
a generic server?
>
> I appreciate your help.
> Marton
> --
> Best Regards,
> Marton Sigmond
> Software Design Engineer
Previous Topic:Help required on shared Editing on Indigo using ECF 3.5.1
Next Topic:Unable to run the Hello example on ecf 3.5
Goto Forum:
  


Current Time: Mon Apr 21 05:57:11 EDT 2014

Powered by FUDForum. Page generated in 0.02936 seconds