ECF Generic server is connecting to the wrong host [message #1002525] |
Fri, 18 January 2013 14: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 #1002604 is a reply to message #1002525] |
Fri, 18 January 2013 18: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 03: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 #1007466 is a reply to message #1003849] |
Tue, 05 February 2013 20: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.04545 seconds