Getting connection refused error while writing data into Aerospike

Hi,

I have installed aerospike community edition version 4.3.0.7 and used java-client 4.1.10, 4.1.10, 4.0.6 etc. I am trying to write data into aerospike , getting “Error Code -8: java.net.ConnectException: Connection refused”.

Could you please anyone let us know which java-client compatible for aerospike community edition version 4.3.0.7.

Thanks

Could you share your connection code?

import com.aerospike.client.*;
import com.aerospike.client.policy.ClientPolicy;
import com.aerospike.client.policy.WritePolicy;

public class AeroRead {

    public static void main(String... args){
        //Get host
        Host host = new Host("xxxxxx.com",3012);

        //create client and write policy
        ClientPolicy clientPolicy = new ClientPolicy();
        WritePolicy writePolicy = new WritePolicy();

 /*Get client object by creating connections | throw exception if server credential is not correct or
 server has not been started yet */
        AerospikeClient client = new AerospikeClient(clientPolicy, host);

        try {
            //get key
            Key key = new Key("test1", "table1", "product");

            //Create Bins for various data types
            Bin b1 = new Bin("bin1", "value1");
            Bin b2 = new Bin("bin2", "value2");

            //Write the records
            client.put(writePolicy, key, b1, b2);

        } catch (AerospikeException e) {
            e.printStackTrace();
        }finally{
            client.close();
        }
    }
}

Aerospike normally doesn’t operate on port 3012, did you make this configuration change? If not then you should be connecting to port 3000.