One bug leads to another... :-) Your fix puts the correct endpoint location into the Zookeeper node. Works great, thanks! But...
If I don't specify org.apache.cxf.ws.address in the service decorator, I would expect it to default to http://localhost:9000/fully/qualified/ClassName as described in the reference guide (http://cxf.apache.org/distributed-osgi-reference.html) under service provider properties. The default would then get transmorgrified into the actual IP of localhost just like the endpoint and inserted into the node. Unfortunately, if I don't specify org.apache.cxf.ws.address, it doesn't show up in the Zookeeper node at all, which means the remote client thinks the web service address is localhost (i.e. bad). Any hope/plan to incorporate the default behavior with the Zookeeper integration? Thanks! Thom -----Original Message----- From: David Bosschaert [mailto:[email protected]] Sent: Monday, August 10, 2009 6:49 AM To: [email protected] Subject: Re: Default endpoint via Zookeeper (D-OSGi) (repost to get its own thread, sorry all) Hi Thomas, Just to let you know I've just committed a fix for this to trunk (1.1-SNAPSHOT). The builds should publish a new snapshot of this tonight. With this fix you can set the org.apache.cxf.ws.address property to a localhost value, like this: props.put("org.apache.cxf.ws.address", "http://localhost:9100/display"); Once it's pushed into the zookeeper server, the localhost and 127.0.0.1 URLs are changed to contain the real IP address of the host, like this: Hope this works for you too. zkCli> get zkCli> /osgi/service_registry/org/apache/cxf/dosgi/samples/discovery/Dis zkCli> playService/10.2.4.18#9100##display # #Mon Aug 10 14:37:47 BST 2009 osgi.remote.endpoint.location=http\://10.2.4.18\:9100/display service.id=40 objectClass=[Ljava.lang.String;@188f506 osgi.remote.interfaces=* osgi.remote.configuration.pojo.address=http\://10.2.4.18\:9100/display osgi.remote.configuration.type=pojo osgi.remote.endpoint.id=f5a3d0ef-b1f6-4fe4-b03f-33190ec28dab ... Cheers, David 2009/8/10 David Bosschaert <[email protected]>: > 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/imp > l/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 > zkCli> /osgi/service_registry/org/apache/cxf/dosgi/samples/discovery/D > zkCli> isplayService > [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 > zkCli> /osgi/service_registry/org/apache/cxf/dosgi/samples/discovery/D > zkCli> isplayService/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 >> >> >
