Hi,
I’m getting an exception in java client, testing simple UDF.
This is my code:
try {
WritePolicy policy = new WritePolicy();
Key key = new Key("test", "myset", "mykey");
Bin bin = new Bin("name", "MyName");
client.put(policy, key, bin);
Record record = client.get(policy, key);
System.out.println("Rec: " + record);
RegisterTask task = client.register(null, "udf/example.lua", "example.lua", Language.LUA);
task.waitTillComplete();
System.out.println("Registerd : " + task.isDone());
String result = (String) client.execute(null, key, "example.lua", "readBin", Value.get("name"));
System.out.println(result);
} catch (Exception e) {
e.printStackTrace();
} finally {
client.close();
}
This is the lua code:
function readBin(r, name)
return r[name]
end
This is the output of the program:
Rec: (gen:18),(exp:165158717),(bins:(name:MyName)) Registerd : true com.aerospike.client.AerospikeException: Error Code 100: UDF: Execution Error 1 at com.aerospike.client.command.ReadCommand.handleUdfError(ReadCommand.java:134) at com.aerospike.client.command.ReadCommand.parseResult(ReadCommand.java:106) at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:56) at com.aerospike.client.AerospikeClient.execute(AerospikeClient.java:848) at com.matomy.test.TestBackup.runTest(TestBackup.java:45) at com.matomy.test.TestBackup.main(TestBackup.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Any idea?