Hi Thomas,

Here are a couple of pointers.

If you look at the Discovery demo, the Service Implementation
Activator, you can see that in this activator it figures out the host
name and sets that in the "osgi.remote.configuration.pojo.address"
property:
https://svn.apache.org/repos/asf/cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java
So you could do something similar when setting the property.

However, if you are setting the property from a static file, this
isn't really convenient. Therefore there is some additional support
for translating 'localhost' into the machine name/IP addr when its
registered in Discovery. If you specify the host in your address
property as 'localhost', the zookeeper code will do a lookup on your
machine name and register it under that (or the IP address). So in my
case I'm getting the following registration in ZooKeeper:
zkCli> ls 
/osgi/service_registry/org/apache/cxf/dosgi/samples/discovery/DisplayService
  [10.2.4.18#9100##display]
So it translated 'localhost' into 10.2.4.18

However, looking at the properties inside the registration, I see that
'localhost' is still in there:
zkCli> get 
/osgi/service_registry/org/apache/cxf/dosgi/samples/discovery/DisplayService/10.2.4.18#9100##display
#
#Mon Aug 10 10:50:22 BST 2009
osgi.remote.endpoint.location=http\://localhost\:9100/display
service.id=40
objectClass=[Ljava.lang.String;@1292ba7
osgi.remote.interfaces=*
osgi.remote.configuration.pojo.address=http\://localhost\:9100/display
osgi.remote.configuration.type=pojo
osgi.remote.endpoint.id=464a4c2f-205c-4a06-a5e2-2f5127dc0894
...

So that's clearly a bug, I've filed
https://issues.apache.org/jira/browse/CXF-2385 and will try to fix
this over the coming few days.

Hope this helps,

David

2009/8/7 Shulok, Thomas <[email protected]>:
> Hi All,
>
> Working with the Zookeeper discovery setup, and things are working as
> long as I explicitly specify org.apache.cxf.ws.address in my service
> decoration xml file. If I don't specify it, it will default to
> localhost. Not unreasonable, but the problem is, localhost will be the
> endpoint that gets registered with Zookeeper. So, when another box looks
> for the interface, Zookeeper will tell it that it is on localhost (i.e.
> the client itself), and that will fail. With this setup, do you have to
> explicitly specify the endpoint, or is there some other default behavior
> to leverage that will actually use the real IP of the registering
> localhost when it gets entered into Zookeeper so other clients can find
> it?
>
> Many thanks,
>
> Thom
>
>

Reply via email to