You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Andrew Eberbach (JIRA)" <ji...@apache.org> on 2006/09/06 00:46:22 UTC

[jira] Created: (MUSE-91) Better handling of finding the right local ip address

Better handling of finding the right local ip address
-----------------------------------------------------

                 Key: MUSE-91
                 URL: http://issues.apache.org/jira/browse/MUSE-91
             Project: Muse
          Issue Type: Improvement
    Affects Versions: 2.0.0
            Reporter: Andrew Eberbach
         Assigned To: Dan Jemiolo
            Priority: Minor
             Fix For: 2.1.0


An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
		
String hostAddress = InetAddress.getLocalHost().getHostAddress();
Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
while(interfaces.hasMoreElements()) {
	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
	Enumeration addresses = nextInterface.getInetAddresses();
	while(addresses.hasMoreElements()) {
		InetAddress address = (InetAddress) addresses.nextElement();
		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
			hostAddress = address.getHostAddress();
			break;
         	}
       }
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Commented: (MUSE-91) Better handling of finding the right local ip address

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MUSE-91?page=comments#action_12439274 ] 
            
Dan Jemiolo commented on MUSE-91:
---------------------------------

The NetworkInterface-based lookup will have to select an address based on which interface is being used to make the current request, but the point of this lookup is to create addresses outside of a request context. This seems more difficult than originally thought. The priority of this is already lowered, so we can work on it if there is time before code freeze or if more users start having problems with it.

> Better handling of finding the right local ip address
> -----------------------------------------------------
>
>                 Key: MUSE-91
>                 URL: http://issues.apache.org/jira/browse/MUSE-91
>             Project: Muse
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Andrew Eberbach
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>             Fix For: 2.1.0
>
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
> 		
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> 	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> 	Enumeration addresses = nextInterface.getInetAddresses();
> 	while(addresses.hasMoreElements()) {
> 		InetAddress address = (InetAddress) addresses.nextElement();
> 		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> 			hostAddress = address.getHostAddress();
> 			break;
>          	}
>        }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Closed: (MUSE-91) Better handling of finding the right local ip address

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MUSE-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Jemiolo closed MUSE-91.
---------------------------

    Resolution: Won't Fix

Andrew and I spent more time on this issue today and realized that we're far beyond the scope of the project; this is a general web services and WS-addressing problem, not something specific to WSRF/WSDM/etc. With all of the special cases to handle, some of which do not appear to be solvable in a generic way, it doesn't make sense to try and build this into Muse. The Muse WS-A code is just a generic way of referencing WS-A data structures, not a complete addressing/networking/routing sub-system.

If it has place in any Apache project, I'd say Axis2. The problems remain, but Axis2 is working on web services implementation problems for all WS users, not just WSRF/WSDM.


> Better handling of finding the right local ip address
> -----------------------------------------------------
>
>                 Key: MUSE-91
>                 URL: https://issues.apache.org/jira/browse/MUSE-91
>             Project: Muse
>          Issue Type: Improvement
>          Components: Core Engine - Routing and Serialization
>    Affects Versions: 2.0.0
>            Reporter: Andrew Eberbach
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
> 		
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> 	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> 	Enumeration addresses = nextInterface.getInetAddresses();
> 	while(addresses.hasMoreElements()) {
> 		InetAddress address = (InetAddress) addresses.nextElement();
> 		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> 			hostAddress = address.getHostAddress();
> 			break;
>          	}
>        }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Updated: (MUSE-91) Better handling of finding the right local ip address

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MUSE-91?page=all ]

Dan Jemiolo updated MUSE-91:
----------------------------

      Component/s: Core Engine - Routing and Serialization
    Fix Version/s: 2.2.0

Let's try and figure this out again during the 2.2 timeframe.

> Better handling of finding the right local ip address
> -----------------------------------------------------
>
>                 Key: MUSE-91
>                 URL: http://issues.apache.org/jira/browse/MUSE-91
>             Project: Muse
>          Issue Type: Improvement
>          Components: Core Engine - Routing and Serialization
>    Affects Versions: 2.0.0
>            Reporter: Andrew Eberbach
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>             Fix For: 2.2.0
>
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
> 		
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> 	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> 	Enumeration addresses = nextInterface.getInetAddresses();
> 	while(addresses.hasMoreElements()) {
> 		InetAddress address = (InetAddress) addresses.nextElement();
> 		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> 			hostAddress = address.getHostAddress();
> 			break;
>          	}
>        }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Commented: (MUSE-91) Better handling of finding the right local ip address

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MUSE-91?page=comments#action_12451627 ] 
            
Jose Antonio commented on MUSE-91:
----------------------------------

I have this problem too with my current project. I need a service that generates a notification with and EPR to a service that must be called at some point but when that EPR is generated it gets the 127.0.0.1.
As the EPR can be modified before sending it, I can use the code above to work aroud this while a better method to find the local IP is implemented. It's a shame that it's not going to be resolved for the 2.1 release.

> Better handling of finding the right local ip address
> -----------------------------------------------------
>
>                 Key: MUSE-91
>                 URL: http://issues.apache.org/jira/browse/MUSE-91
>             Project: Muse
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Andrew Eberbach
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
> 		
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> 	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> 	Enumeration addresses = nextInterface.getInetAddresses();
> 	while(addresses.hasMoreElements()) {
> 		InetAddress address = (InetAddress) addresses.nextElement();
> 		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> 			hostAddress = address.getHostAddress();
> 			break;
>          	}
>        }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Updated: (MUSE-91) Better handling of finding the right local ip address

Posted by "Dan Jemiolo (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MUSE-91?page=all ]

Dan Jemiolo updated MUSE-91:
----------------------------

    Fix Version/s:     (was: 2.1.0)

not going to be able to figure this out for 2.1

> Better handling of finding the right local ip address
> -----------------------------------------------------
>
>                 Key: MUSE-91
>                 URL: http://issues.apache.org/jira/browse/MUSE-91
>             Project: Muse
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Andrew Eberbach
>         Assigned To: Dan Jemiolo
>            Priority: Minor
>
> An interesting problem surfaced recently. If you want to figure out an EPR (for subscription, say) you'll need to get the ip address. However, InetAddress.getLocalHost().getHostAddress() can bind to a local interface and get either a loopback address or a 192.168.X.X address... this is bad. Here's some code to look for the first non-loopback and non-local address.
> 		
> String hostAddress = InetAddress.getLocalHost().getHostAddress();
> Enumeration interfaces = java.net.NetworkInterface.getNetworkInterfaces();
> while(interfaces.hasMoreElements()) {
> 	NetworkInterface nextInterface = (NetworkInterface) interfaces.nextElement();
> 	Enumeration addresses = nextInterface.getInetAddresses();
> 	while(addresses.hasMoreElements()) {
> 		InetAddress address = (InetAddress) addresses.nextElement();
> 		if(!address.isLoopbackAddress() && !address.isSiteLocalAddress()) {
> 			hostAddress = address.getHostAddress();
> 			break;
>          	}
>        }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org