Spring GemFire
  1. Spring GemFire
  2. SGF-28

Sample fails to run on Ubuntu with SocketException "bad argument for IP_MULTICAST_IF"

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 1.0.0.M2
    • Fix Version/s: 1.0.1
    • Labels:
      None

      Description

      This is the exception:

      Caused by: java.net.SocketException: bad argument for IP_MULTICAST_IF: address not bound to any interface
      at java.net.PlainDatagramSocketImpl.socketSetOption(Native Method)
      at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:299)
      at java.net.MulticastSocket.setInterface(MulticastSocket.java:420)
      at com.gemstone.org.jgroups.protocols.UDP.createSockets(UDP.java:669)
      at com.gemstone.org.jgroups.protocols.UDP.start(UDP.java:535)

      Gemfire needs a way to find the other caches in the network. Either multicast or a locator process can be used for that. Locator is the recommended approach so that would be the preferred solution.

      A quick workaround is to use "-Djava.net.preferIPv4Stack=true".

        Activity

        Hide
        Costin Leau added a comment -

        (from SGF-32)
        Another workaround is to fix the hostname resolution. For some reason Ubuntu always wants to put 127.0.1.1 in your /etc/hosts and alias it to your local hostname. Java looks up the hostname and translates it to an IP 127.0.1.1 which is usually not set up. To fix it you ca add your local hostname as an alias for 127.0.0.1 (as well as localhost), and make sure it is at the top of /etc/hosts, e.g.

        # /etc/hosts
        127.0.0.1 localhost myhost
        127.0.1.1 myhost myhost.mydomain
        ...
        
        Show
        Costin Leau added a comment - (from SGF-32 ) Another workaround is to fix the hostname resolution. For some reason Ubuntu always wants to put 127.0.1.1 in your /etc/hosts and alias it to your local hostname. Java looks up the hostname and translates it to an IP 127.0.1.1 which is usually not set up. To fix it you ca add your local hostname as an alias for 127.0.0.1 (as well as localhost), and make sure it is at the top of /etc/hosts, e.g. # /etc/hosts 127.0.0.1 localhost myhost 127.0.1.1 myhost myhost.mydomain ...
        Hide
        Costin Leau added a comment -

        Added entry in the docs, explaining the issue. Additionally added the param into the sample pom so now it should be added automatically.

        Show
        Costin Leau added a comment - Added entry in the docs, explaining the issue. Additionally added the param into the sample pom so now it should be added automatically.

          People

          • Assignee:
            Costin Leau
            Reporter:
            Rossen Stoyanchev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: