ECF Generic server is connecting to the wrong host [message #1002525] |
Fri, 18 January 2013 19:05  |
Eclipse User |
|
|
|
I have a remote server application running locally and on a remote host (10.1.1.33). The client is connecting to the local instance even though I configured it to connect remote instance. Is there something else I need to configure?
private static final int DEFAULT_PORT = 3787;
private static String HOST= "10.1.1.33";
private BundleContext bundleContext;
private RemoteConfigurationUtil proxy;
private List<IProxyListener> listeners= new ArrayList<>();
private ServiceTracker<RemoteConfigurationUtil, RemoteConfigurationUtil> st;
public RemoteServiceTracker() {
this.bundleContext=Activator.getContext();
IGenericServerContainerGroup group;
try {
ServiceReference<IGenericServerContainerGroupFactory> sr = bundleContext.getServiceReference(IGenericServerContainerGroupFactory.class);
IGenericServerContainerGroupFactory proxy = bundleContext.getService(sr);
group = proxy.createContainerGroup(HOST, DEFAULT_PORT, null);
group.createContainer("/server");
...
...
|
|
|
Re: ECF Generic server is connecting to the wrong host [message #1002549 is a reply to message #1002525] |
Fri, 18 January 2013 20:21   |
Eclipse User |
|
|
|
Hi Greg,
I don't think I'm understanding your environment yet...so some hopefully diagnostic questions:
1) The snippet of code you supply looks like it's for the configuration/startup of the non-localhost server, right?
2) You say that the client is incorrectly connecting to the local server instance (i.e. one at ecftcp://localhost:3282/server, I expect?). And you also say that you are configuring the client to connect to the remote instance (presumably the one at: ecftcp://10.1.1.33:3787/server). How are you configuring the client to do this?
3) What discovery mechanism are you using?
4) Is your client (and localhost server) on the 10.1.1.33 LAN?...or on some other LAN?
Thanks,
Scott
|
|
|
Re: ECF Generic server is connecting to the wrong host [message #1002604 is a reply to message #1002525] |
Fri, 18 January 2013 23:20   |
Eclipse User |
|
|
|
The snippet I posted was for the client. Here is the server code.
Dictionary<String, String> dict = new Hashtable<String, String>();
// add OSGi service property indicated export of all interfaces exposed
// by service (wildcard)
dict.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES, IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
// add OSGi service property specifying config
dict.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS, CONTAINER_TYPE);
// add ECF service property specifying container factory args
dict.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS, "ecftcp://localhost:3787/server");
try {
bundleContext.registerService(new String[] {
ConfigurationUtil.class.getName(), EMailUtil.class.getName(), ServiceUtil.class.getName(),
RemoteConfigurationUtil.class.getName()} , new RemoteConfigurationUtilImpl(props), dict);
log.info("RemoteConfigurationUtilImpl RemoteService registered");
}catch(Exception e){
e.printStackTrace();
}
I am using jmdns, but I really don't need discovery because I only need to connect to a static IP. This was the closest example that I could find for a point to point connection.
10.1.1.33 is the ip of the server, it is on the same lan as the client.
Thanks,
Greg
|
|
|
Re: ECF Generic server is connecting to the wrong host [message #1002733 is a reply to message #1002604] |
Sat, 19 January 2013 08:34   |
Eclipse User |
|
|
|
On 01/19/2013 12:20 AM, Greg Babcock wrote:
> The snippet I posted was for the client. Here is the server code.
>
>
> Dictionary<String, String> dict = new Hashtable<String, String>();
> // add OSGi service property indicated export of all interfaces
> exposed
> // by service (wildcard)
> dict.put(IDistributionConstants.SERVICE_EXPORTED_INTERFACES,
> IDistributionConstants.SERVICE_EXPORTED_INTERFACES_WILDCARD);
> // add OSGi service property specifying config
> dict.put(IDistributionConstants.SERVICE_EXPORTED_CONFIGS,
> CONTAINER_TYPE);
> // add ECF service property specifying container factory args
>
> dict.put(IDistributionConstants.SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS,
> "ecftcp://localhost:3787/server");
> try {
> bundleContext.registerService(new String[] {
> ConfigurationUtil.class.getName(),
> EMailUtil.class.getName(), ServiceUtil.class.getName(),
> RemoteConfigurationUtil.class.getName()} , new
> RemoteConfigurationUtilImpl(props), dict);
> log.info("RemoteConfigurationUtilImpl RemoteService
> registered");
> }catch(Exception e){
> e.printStackTrace();
> }
>
>
> I am using jmdns, but I really don't need discovery because I only need
> to connect to a static IP. This was the closest example that I could
> find for a point to point connection.
> 10.1.1.33 is the ip of the server, it is on the same lan as the client.
Hi Greg,
with this configuration you will end up with JmDNS announcing your
service as "ecftcp://localhost:3787/server" and consumers will obviously
fail to connect to the remote service provider but connect to localhost
instead. Try without SERVICE_EXPORTED_CONTAINER_FACTORY_ARGUMENTS or at
least set the hostname to the external name of the machine providing the
service.
HTH
Markus
|
|
|
|
Re: ECF Generic server is connecting to the wrong host [message #1003849 is a reply to message #1002837] |
Tue, 22 January 2013 05:53   |
Eclipse User |
|
|
|
On 01/19/2013 04:37 PM, Greg Babcock wrote:
> Thank you for your reply. I tried using both the ip and server name
> without any luck. If it makes any difference, I am accessing the server
> via a VPN. Is it possible to establish a connection without using
> discovery?
Hi Greg,
I wonder if it is really JmDNS that is still announcing the service as
localhost. Can you use an scanner like 'mdns-scan' and check what gets
announced on your LAN?
Markus
|
|
|
Re: ECF Generic server is connecting to the wrong host [message #1007466 is a reply to message #1003849] |
Wed, 06 February 2013 01:40  |
Eclipse User |
|
|
|
Markus,
Using Wire Shark I looked at the communications and determined that the problem is probably caused by the VPN configuration not passing the mDNS packets. After a little research I decided that zookeeper would be a better fit for the application, and have been able to make it work.
Thanks for your support!
|
|
|
Powered by
FUDForum. Page generated in 0.05346 seconds