[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Problem with Service Endpoint matching when using different network names

Hi Peter,

On 6/21/2018 2:08 AM, Peter Hermsdorf wrote:


I need to bring up a issue that was already discussed earlier, eg.


and here


The issue is, that in our setup, the service matching is not working when accessing the remote server using a different hostname than the machine uses itself (a little hard to express as non native speaker ;) see ENDPOINT definition below)

Scott's last comment on the problem was to get more information about our use case and environment so I'll try to provide the required information

* we have a lot of clients using remote services from one application server

* we use the ecf generic provider.

* the remote service "discovery" is done by generating an EndpointDescription on client side, as all clients know by configuration which server to speak to. We use something like this to define the service endpoint:

props.put(ENDPOINT_ID, "ecftcp://" + host + ":8889/server");

where host is the hostname or IP address under which the client can access the remote server - which is not necessarily the hostname or IP which is configured at the server itself (which is exactly the issue). So eg. the server is exporting the service under endpoint


whereas the client needs to access the server eg. by using

ecftcp://otherhostname.public.net:8889/server or by ecftcp://

as endpoint id.

and even case sensitivity does matter: Some Windows machines (for whatever reason) have hostnames like MYHOSTNAME.company.local. Clients then are required to use the exact hostname with the correct upper/lowercase to access the server.

* the remote services are imported on client side via


* the remote services are exported on server side using DS with additional properties, like:

@Component(immediate = true, property = {
ÂÂÂ ÂÂÂ "service.exported.interfaces=*",
ÂÂÂ ÂÂÂ "service.exported.configs=ecf.generic.server",
ÂÂÂ ÂÂÂ "ecf.generic.server.port=8889" })
public class MyserviceService implements IMyService {

* on server side we have a custom implementation of IHostContainerSelector which allows us to override

protected IRemoteServiceContainer createRSContainer

to add a custom RegistrySharedObject which customizes error handling ("exception to String serialization")

That's it i think.

So getting rid of the hostname part in the endpoint description and/or when matching would probably solve the problem...

Thanks for any hints on this issue!

Ok, thanks for the description of the issue.ÂÂ For this use case:Â i.e. hostname used by clients that are different from the bind address for the server...i.e. client wants to use:


and the server needs to expose/listen on this interface:

myhostname.company.local (or rather the ip address if the interface for this name)

For the generic provider, here are the remote service configuration properties


For the *external* address/name these are the relevant properties:

ecf.generic.server.hostname = otherhostname.public.net
ecf.generic.server.port = 8889
ecf.generic.server.path = /server

for example, these values will result in an external name of: ecftcp://otherhostname.public.net:8889/server. For the generic provider the name of the container and the external name must match.

There is also a service property:

ecf.generic.server.bindAddress = InetAddress.getByName("myhostname.company.local")

or InetAddress.getByName("")...with your actual IP.

The bindAddress property ultimately specifies the *address that is passed to this ServerSocket constructor to listen on for the ecftcp server:

new ServerSocket(port, backlog, bindAddress)


So I think the solution for your use case is to use all four of these service properties set appropriately...e.g.:

ecf.generic.server.hostname = otherhostname.public.net
ecf.generic.server.port = 8889
ecf.generic.server.path = /server
ecf.generic.server.bindAddress = InetAddress.getByName("myhostname.company.local")

Since I don't currently have access to a dual-homed server I haven't been able to test this fully, but really the only thing it does is to pass the bindAddress to the ServerSocket, rather than using the default ('')...which is all interfaces.

I realize now that the use of the InetAddress instance in the service properties is a little clumsy...it would be better if it could also take a String...e.g.:


If the above works for you/your use case, I'll add this (support of String as well as InetAddress) in a new enhancement for 3.14.1.

BTW...since you are overriding the HostContainerSelector for another purpose, you could pass the bindAddress (and the other properties explicitly by overriding AbstractContainerSelector.createContainer, or AbstractContainerSelector.getContainerFactoryArguments.ÂÂ Be a little careful with this, however, as these methods are responsible for doing the RSA-specified handling of service properties (e.g. the ecf.generic.server. prefix is stripped off before the hostname, port, path, bindAddress are passed to the container instantiator as per RSA).

Another way to accomplish the above would be to also use the RemoteServiceAdmin on the server-side (in addition to the import/client side).ÂÂ i.e. you can explicitly export a service with:

RemoteServiceAdmin.exportService(ServiceReference,Map<String,?> overridingProperties);

The exportService is usually done by the BasicTopologyManager when a remote service is registered with a call to:

RemoteServiceAdmin.exportService(ref, null)

but you can do it yourself programmatically at any time after registration via the exportService.ÂÂ Note the overridingProperties...that allows you to set any properties you want (e.g. your four and the required service.exported.interfaces) that will be used to configure the server container, but then it doesn't require any properties set via @Component.ÂÂ This might be more convenient for you/your use case, since you may not want to have all of the properties and their values hard coded in the @Component metadata.ÂÂ With exportService you can also do things like use config admin to config your exports rather than putting app-specific info in the @Component properties.

The more that I think about it, the less I think you should look to override the HostContainerSelector...and rather use RemoteServiceAdmin.exportService if you need/want to do things programmatically on the export side.ÂÂ

Best regards,


BTW: the search function of the ecf-dev archive does not seem to work:


click on search results in a 404

Thanks...this appears to be some sort of EF infrastructure problem...I've opened this bug:



ecf-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit