Getting InvalidNamespace: Error 20,1: Partition map empty with java client only, go client is fine

Running a 7.1.0.1 local aero server, the following code in go works (v7 sdk)

	cp := aero.NewClientPolicy()
	cp.User = ""
	cp.Password = ""
	cp.Timeout = 1 * time.Second
	ash := aero.NewHost("127.0.0.1", 3000)
	client, err := aero.NewClientWithPolicyAndHost(cp, ash)
	if err != nil { fmt.Printf("Err: %v\n", err)}

	statement := aero.NewStatement("myns", "myset", "SessionID", "Time")
	qp := aero.NewQueryPolicy()
	qp.FilterExpression = aero.ExpEq(aero.ExpStringBin("SessionID"), aero.ExpStringVal("48e9bb5c-d2e1-4e1c-b6c2-9b9dfd271add"))
	recordset, err := client.Query(qp, statement)

	cnt := 0
	for res := range recordset.Results() {
		cnt++
		if res.Err != nil {
			fmt.Printf("%#v\n", res.Err)
		} else {
			fmt.Printf("%#v\n", *res.Record)
		}
	}
	fmt.Println("count of rows:", cnt)
	recordset.Close()

but the following code in java fails (java8, aerospike-client-jdk8-8.1.1.jar)

        ClientPolicy cp = new ClientPolicy();
        cp.setUser("");
        cp.setPassword("");
        cp.setTimeout(1);
        Host h = new Host("127.0.0.1", 3000);
        AerospikeClient client = new AerospikeClient(cp, h);

        Statement stmt = new Statement();
        stmt.setNamespace("myns");
        stmt.setSetName("myset");
        stmt.setBinNames("SessionID", "Time");
        QueryPolicy qp = new QueryPolicy();
        qp.filterExp = Exp.build(Exp.eq(Exp.stringBin("SessionID"), Exp.val("48e9bb5c-d2e1-4e1c-b6c2-9b9dfd271add")));

        try {
            RecordSet rs = client.query(qp, stmt);
            while (rs.next()) {
                Record record = rs.getRecord();
                System.out.printf("rec=[%s]\n", record.bins);
            }
        } catch (Exception e) {
            System.out.printf("err=[%s]\n", e);
            e.printStackTrace();
        }

The error is com.aerospike.client.AerospikeException$InvalidNamespace: Error 20,1: Partition map empty

at com.aerospike.client.query.PartitionTracker.assignPartitionsToNodes(PartitionTracker.java:233)
at com.aerospike.client.query.QueryPartitionExecutor.execute(QueryPartitionExecutor.java:83)
at com.aerospike.client.query.QueryPartitionExecutor.run(QueryPartitionExecutor.java:72)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)

Code seems the same, it’s not a server issue because the go client works. Any idea what I’m missing? Thanks.

There is an underlying cluster tend error that is preventing the client cluster from being formed. Enable client logging to find out why:

Node … 127.0.0.1 3000 refresh failed: java.lang.NoClassDefFoundError: gnu/crypto/util/Base64 at com.aerospike.client.util.Crypto.decodeBase64(Crypto.java:49)

Missing jar was the problem, thanks for your help.

The gnu-crypto-2.0.1.jar dependency is not included in your classpath. “aerospike-client-jdk8-8.1.1.jar” does not include it’s dependencies.

Go to Aerospike Downloads | Aerospike and click on “JDK” jdk8 and “Library” “Jar with dependencies”. Then, click download. The resulting “aerospike-client-jdk8-8.1.1-jar-with-dependencies.jar” includes all client dependencies.

1 Like

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.