com.gemstone.gemfire.cache.client.NoAvailableLocatorsException: Unable to connect to any locators in the list [localhost[11235]:10334]

Spring JIRA | John Blum | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Currently, the resolution of Spring property placeholders in the {{<gfe:pool>}}, "{{locators}}" and "{{servers}}" attributes does not function properly since the logic to parse the value of a particular property placeholder is misplaced. The logic parsing the attribute values is inappropriately placed in the [PoolParser|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java]. Specifically, the following [lines of code|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L81-L82] initiate the parsing of the "{{locators}}" and "{{servers}}" attributes, respectively. This leads to the following calls for [locators|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L168-L170] and [servers|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L181-L183], respectively. However, by the time the Thread of execution reaches the code to [parse a connection|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L137-L152], the value of the '{{hostPort}}' combo is actually the Spring property placeholder and not the value of the property placeholder. This leads to the following Exception at runtime when the client attempts to connect to the server using the configured GemFire Pool... {code:java} com.gemstone.gemfire.cache.client.NoAvailableLocatorsException: Unable to connect to any locators in the list [localhost[11235]:10334] at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer(AutoConnectionSourceImpl.java:136) at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:206) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:214) at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:134) at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:113) at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:702) at com.gemstone.gemfire.cache.client.internal.GetOp.execute(GetOp.java:94) at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.get(ServerRegionProxy.java:133) at com.gemstone.gemfire.internal.cache.LocalRegion.findObjectInSystem(LocalRegion.java:2739) at com.gemstone.gemfire.internal.cache.LocalRegion.nonTxnFindObject(LocalRegion.java:1464) at com.gemstone.gemfire.internal.cache.LocalRegionDataView.findObject(LocalRegionDataView.java:133) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1348) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1311) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1298) at com.gemstone.gemfire.internal.cache.AbstractRegion.get(AbstractRegion.java:321) ... {code} And more specifically... {code:java} java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at com.gemstone.gemfire.internal.SocketUtils.connect(SocketUtils.java:88) at com.gemstone.gemfire.internal.SocketUtils.connect(SocketUtils.java:60) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:1011) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:946) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:936) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.getServerVersion(TcpClient.java:163) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.requestToServer(TcpClient.java:90) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.requestToServer(TcpClient.java:78) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.queryOneLocator(AutoConnectionSourceImpl.java:188) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.queryLocators(AutoConnectionSourceImpl.java:220) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer(AutoConnectionSourceImpl.java:132) at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:206) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefillConnection(ConnectionManagerImpl.java:794) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefill(ConnectionManagerImpl.java:737) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl$PrefillConnectionsTask.run2(ConnectionManagerImpl.java:888) at com.gemstone.gemfire.cache.client.internal.PoolImpl$PoolTask.run(PoolImpl.java:1249) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code}

    Spring JIRA | 2 years ago | John Blum
    com.gemstone.gemfire.cache.client.NoAvailableLocatorsException: Unable to connect to any locators in the list [localhost[11235]:10334]
  2. 0

    Currently, the resolution of Spring property placeholders in the {{<gfe:pool>}}, "{{locators}}" and "{{servers}}" attributes does not function properly since the logic to parse the value of a particular property placeholder is misplaced. The logic parsing the attribute values is inappropriately placed in the [PoolParser|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java]. Specifically, the following [lines of code|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L81-L82] initiate the parsing of the "{{locators}}" and "{{servers}}" attributes, respectively. This leads to the following calls for [locators|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L168-L170] and [servers|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L181-L183], respectively. However, by the time the Thread of execution reaches the code to [parse a connection|https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/config/PoolParser.java#L137-L152], the value of the '{{hostPort}}' combo is actually the Spring property placeholder and not the value of the property placeholder. This leads to the following Exception at runtime when the client attempts to connect to the server using the configured GemFire Pool... {code:java} com.gemstone.gemfire.cache.client.NoAvailableLocatorsException: Unable to connect to any locators in the list [localhost[11235]:10334] at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer(AutoConnectionSourceImpl.java:136) at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:206) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:214) at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:134) at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:113) at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:702) at com.gemstone.gemfire.cache.client.internal.GetOp.execute(GetOp.java:94) at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.get(ServerRegionProxy.java:133) at com.gemstone.gemfire.internal.cache.LocalRegion.findObjectInSystem(LocalRegion.java:2739) at com.gemstone.gemfire.internal.cache.LocalRegion.nonTxnFindObject(LocalRegion.java:1464) at com.gemstone.gemfire.internal.cache.LocalRegionDataView.findObject(LocalRegionDataView.java:133) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1348) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1311) at com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1298) at com.gemstone.gemfire.internal.cache.AbstractRegion.get(AbstractRegion.java:321) ... {code} And more specifically... {code:java} java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at com.gemstone.gemfire.internal.SocketUtils.connect(SocketUtils.java:88) at com.gemstone.gemfire.internal.SocketUtils.connect(SocketUtils.java:60) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:1011) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:946) at com.gemstone.gemfire.internal.SocketCreator.connect(SocketCreator.java:936) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.getServerVersion(TcpClient.java:163) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.requestToServer(TcpClient.java:90) at com.gemstone.org.jgroups.stack.tcpserver.TcpClient.requestToServer(TcpClient.java:78) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.queryOneLocator(AutoConnectionSourceImpl.java:188) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.queryLocators(AutoConnectionSourceImpl.java:220) at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer(AutoConnectionSourceImpl.java:132) at com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:206) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefillConnection(ConnectionManagerImpl.java:794) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefill(ConnectionManagerImpl.java:737) at com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl$PrefillConnectionsTask.run2(ConnectionManagerImpl.java:888) at com.gemstone.gemfire.cache.client.internal.PoolImpl$PoolTask.run(PoolImpl.java:1249) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) {code}

    Spring JIRA | 2 years ago | John Blum
    com.gemstone.gemfire.cache.client.NoAvailableLocatorsException: Unable to connect to any locators in the list [localhost[11235]:10334]

    Root Cause Analysis

    1. com.gemstone.gemfire.cache.client.NoAvailableLocatorsException

      Unable to connect to any locators in the list [localhost[11235]:10334]

      at com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer()
    2. com.gemstone.gemfire
      AbstractRegion.get
      1. com.gemstone.gemfire.cache.client.internal.AutoConnectionSourceImpl.findServer(AutoConnectionSourceImpl.java:136)
      2. com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:206)
      3. com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:214)
      4. com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:134)
      5. com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:113)
      6. com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:702)
      7. com.gemstone.gemfire.cache.client.internal.GetOp.execute(GetOp.java:94)
      8. com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.get(ServerRegionProxy.java:133)
      9. com.gemstone.gemfire.internal.cache.LocalRegion.findObjectInSystem(LocalRegion.java:2739)
      10. com.gemstone.gemfire.internal.cache.LocalRegion.nonTxnFindObject(LocalRegion.java:1464)
      11. com.gemstone.gemfire.internal.cache.LocalRegionDataView.findObject(LocalRegionDataView.java:133)
      12. com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1348)
      13. com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1311)
      14. com.gemstone.gemfire.internal.cache.LocalRegion.get(LocalRegion.java:1298)
      15. com.gemstone.gemfire.internal.cache.AbstractRegion.get(AbstractRegion.java:321)
      15 frames