Menu

Connection Refused to 127.0.0.1 on Windows

2009-07-16
2013-05-14
  • Mike Cantrell

    Mike Cantrell - 2009-07-16

    Hello,

    I'm attempting to configure the RMI Multicast distributed cache and
    everything works fine as long as the JVMs are on the same physical
    server. When I deploy my app with identical configurations to seperate
    machines, I get the following error for every cache that tries
    bootstrapping:

    2009-07-16 13:39:55,605 DEBUG
    distribution.MulticastKeepaliveHeartbeatReceiver We are already
    processing these rmiUrls. Another heartbeat came before we finished:
    //172.16.1.140:40001/dailyCache|//172.16.1.140:40001/microCache|//172.16.1.140:40001/hourlyCache|//172.16.1.140:40001/weeklyCache|//172.16.1.140:40001/monthlyCache|//172.16.1.140:40001/eternalCache
    2009-07-16 13:39:55,621 DEBUG distribution.RMIBootstrapCacheLoader
    cache peers: [RMICachePeer_Stub[UnicastRef2 [liveRef:
    [endpoint:[127.0.0.1:3336,net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory@1d4c0](remote),objID:[-dc96a19:12284d6c285:-7fec,
    7155764359885223201]]]]]
    2009-07-16 13:39:55,621 DEBUG distribution.RMIBootstrapCacheLoader
    Bootstrapping weeklyCache from RMICachePeer_Stub[UnicastRef2 [liveRef:
    [endpoint:[127.0.0.1:3336,net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory@1d4c0](remote),objID:[-dc96a19:12284d6c285:-7fec,
    7155764359885223201]]]]
    2009-07-16 13:39:56,558 WARN  distribution.RMIBootstrapCacheLoader
    Error asynchronously performing bootstrap. The cause was: Error
    bootstrapping from remote peer. Message was: Connection refused to
    host: 127.0.0.1; nested exception is:
           java.net.ConnectException: Connection refused: connect
    net.sf.ehcache.distribution.RemoteCacheException: Error bootstrapping
    from remote peer. Message was: Connection refused to host: 127.0.0.1;
    nested exception is:
           java.net.ConnectException: Connection refused: connect
           at net.sf.ehcache.distribution.RMIBootstrapCacheLoader.doLoad(RMIBootstrapCacheLoader.java:175)
           at net.sf.ehcache.distribution.RMIBootstrapCacheLoader$BootstrapThread.run(RMIBootstrapCacheLoader.java:106)
    Caused by: java.rmi.ConnectException: Connection refused to host:
    127.0.0.1; nested exception is:
           java.net.ConnectException: Connection refused: connect
           at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
           at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
           at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
           at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
           at net.sf.ehcache.distribution.RMICachePeer_Stub.getKeys(Unknown Source)
           at net.sf.ehcache.distribution.RMIBootstrapCacheLoader.doLoad(RMIBootstrapCacheLoader.java:145)
           ... 1 more
    Caused by: java.net.ConnectException: Connection refused: connect
           at java.net.PlainSocketImpl.socketConnect(Native Method)
           at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
           at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
           at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
           at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
           at java.net.Socket.connect(Socket.java:519)
           at java.net.Socket.connect(Socket.java:469)
           at java.net.Socket.<init>(Socket.java:366)
           at java.net.Socket.<init>(Socket.java:180)
           at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
           at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
           at net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory.createSocket(ConfigurableRMIClientSocketFactory.java:72)
           at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
           ... 6 more

    My configuration is pretty standard:

       <cacheManagerPeerProviderFactory
               class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
               properties="hostName=, peerDiscovery=automatic,
    multicastGroupAddress=230.0.0.1,multicastGroupPort=4447,
    timeToLive=32"/>

       <cacheManagerPeerListenerFactory
    class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
                                        properties="hostName=, port=40001"/>

       <cache name="weeklyCache"
              maxElementsInMemory="10000"
              eternal="false"
              timeToLiveSeconds="604800"
              overflowToDisk="true"
              diskPersistent="true"
              diskExpiryThreadIntervalSeconds="120"
              memoryStoreEvictionPolicy="LRU">
           <cacheEventListenerFactory
    class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
           <bootstrapCacheLoaderFactory
    class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
       </cache>

    I've tried both 1.5.0 and 1.6.0 and both behave the same. I've seen
    the entry on the FAQ regarding linux returning the loopback adapter
    for InetAddress.getLocalHost() but I've verified that it's returning
    the correct, public address. The servers are running on windows 2003
    server on vmware and there is only 1 network adapter configured on
    each server.

    I'm a bit stumped... any help or ideas would be greatly appreciated!

    Summary:

    windows 2003 server on vmware
    1 network adapter each
    tomcat 6.0.20
    sun jvm 1.6.0_14

     
    • Mike Cantrell

      Mike Cantrell - 2009-07-31

      For what it's worth, the problem only occurred on vmware and windows. I switched the implementation to JGroups Multicast UDP and it works.

       

Log in to post a comment.