I have a case where I 3 cxf services.  Each is configurable as to host ip and
port number.  If I configure them all with the same host ip or i change the
host ip and port numbers everything works fine.  But if I attempt to do
something like exposing service 1 on ip 10.198.162.1 port 8080 and service 2
on ip 10.198.162.2 port 8080, only service 1 ends up listening for traffic. 
Service 2 is unreachable.

I traced through the cxf-rt-transports-http-jetty-2.4.2 package and found
that the JettyHTTPServiceFactory is holding http engines in a portMap keyed
on an Integer port value.  When the code looks to see if it needs to create
another engine, it decides it doesn't need to because there is already an
engine with that port number, so it just uses the existing one even though
they are supposed to be on different network interfaces.

It seems that if the map were keyed with a combination of host ip and port,
say changing it to a String value and maybe concatenating the key,
"10.198.162.1:8080" and "10.198.162.2:8080" that this would not be an issue.  

Before I go do that to resolve my issue, I'm wondering if there is some
reason the factory is designed the way it is.  I can see that the behavior
might be a bit undefined if you had both a specific interface and 0.0.0.0 on
the same port, but other than that, I can't see an issue with supporting
multihomed environments.

Thanks in advance for you input.

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Unable-to-configure-cxf-endpoints-on-different-network-interfaces-with-the-same-port-tp5033198p5033198.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to