jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Al Forbes" <forbes...@googlemail.com>
Subject Re: IPv6 problem on Linux
Date Wed, 21 Mar 2007 16:10:30 GMT
Hi Zsolt,

Have you tried using changing the rmi property with something like:

-Djava.rmi.server.useLocalHostname=true

Regards
Al

On 20/03/07, Zsolt Varszegi <zsolt@switchfire.com> wrote:
> Hi,
>
> I was trying to set up a distributed cache architecture with JCS, the
> memory cache and the disk auxiliary were working just fine but I could
> not set up the remote auxiliary properly.
>
> After some investigation I suspect that the reason the client could not
> communicate with the server properly has to do with the JCS code relying
> on InetAddress.getLocalHost() method call which returns ambiguous
> results on Linux systems. (I later found a bug report about this at
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4665037 ).
>
> E.g.: client looking up an IPv6 enabled Fedora Core 6 server:
>
> "looking up server
> //192.168.6.28:1102/org.apache.jcs.auxiliary.remote.behavior.IRemoteCach
> eService"
> org.apache.jcs.auxiliary.remote.RemoteCacheManager 107:Naming.lookup(
> "//192.168.6.28:1102/org.apache.jcs.auxiliary.remote.behavior.IRemoteCac
> heService" );
>  "server found"
>  "remote service = RemoteCacheServer_Stub ...
> endpoint:[0:0:0:0:0:0:0:1:1103](remote),objID:[7c19e...  etc."
>
>
> at the same time the same client looking up another also IPv6 enabled
> Fedora Core 6 server:
>
>  "looking up server
> //192.168.10.59:1102/org.apache.jcs.auxiliary.remote.behavior.IRemoteCac
> heService"
>  org.apache.jcs.auxiliary.remote.RemoteCacheManager 107:Naming.lookup(
> "//192.168.10.59:1102/org.apache.jcs.auxiliary.remote.behavior.IRemoteCa
> cheService" );
>  "server found"
>  "remote service = RemoteCacheServer_Stub ...
> endpoint:[192:168.10.59:1103](remote),objID:[806c6c..."
>
>
> A possible workaround could be to replace the
> InetAddress.getLocalHost() calls with a method similar to the snippet
> below to return the IP address that enables RMI calls from remote
> machines:
>
>
> public static String getLocalHostAddress() throws UnknownHostException{
>   return getLocalHostLANAddress().toString();
>  }
>
>
> public static InetAddress getLocalHostLANAddress() throws
> UnknownHostException {
>  try {
>   for(Enumeration ifaces = NetworkInterface.getNetworkInterfaces();
> ifaces.hasMoreElements();){
>    NetworkInterface iface = (NetworkInterface)ifaces.nextElement();
>    for(Enumeration inetAddrs = iface.getInetAddresses();
> inetAddrs.hasMoreElements();){
>     InetAddress inetAddr = (InetAddress)inetAddrs.nextElement();
>     if (!inetAddr.isLoopbackAddress() && inetAddr.isSiteLocalAddress())
> {
>      return
> InetAddress.getByAddress(InetAddress.getLocalHost().getHostName(),
> inetAddr.getAddress());
>     }
>    }
>   }
>  }
>  catch (Exception e) {
>   throw new UnknownHostException("Failed to determine LAN address: " +
> e);
>  }
>  throw new UnknownHostException("Failed to locate LAN address.");
> }
>
>
> I could bypass the problem by completely disabling IPv6 on our server
> but for the future it might be beneficial to ensure JCS runs reliably on
> Linux without a need to make such configuration.
>
> If you think there are other ways to sort out this issue please let me
> know.
>
> Regards:
> Zsolt
>
> P.S.: Good luck with JCS - a very nice piece of work otherwise.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message