How fix No server chosen by ReadPref

Hi

how to fix this error:

No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=192.168.71.130:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 11]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, roundTripTimeNanos=82811743, setName=‘rs0’, canonicalAddress=192.168.71.130:27017, hosts=[192.168.71.128:27017, 192.168.71.129:27017, 192.168.71.130:27017], passives=, arbiters=, primary=‘null’, tagSet=TagSet{}, electionId=null, setVersion=1, lastWriteDate=Mon Aug 29 15:48:46 IRDT 2022, lastUpdateTimeNanos=21968293986802}, ServerDescription{address=192.168.71.129:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketException: Malformed reply from SOCKS server}}, ServerDescription{address=192.168.71.128:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketException: Malformed reply from SOCKS server}}]}. Waiting for 30000 ms before timing out


im 3 node (vm) ubuntu 20.04.4 and installed mongo 4.4 and clustered mongodb replicaSet, after down one node other node success work but down 2 node my jar file is errord, how tind and fix is error?

thanks.

Welcome to the MongoDB Community @omidzamani !

java.net.SocketException: Malformed reply from SOCKS server

Is your application connecting to your deployment via a proxy? What options are you using in your connection string and what version of the MongoDB Java driver?

I notice your replica set is using private IPs (192.168.*) which will require the calling application to be on the same network (or have routing via VPN/VPC) in order to establish a replica set connection.

The expected behaviour for a replica set connection is that clients use the hostnames, IPs, and ports specified in the replica set configuration.

Regards,
Stennie