Nn_index.h:71: error: (-215:Assertion failed) in Java

hmm, careful. is it actually thread-safe ?

however, the error complains, that your query size did not match the train data.

can you show, how you call it ?
add more own tests for this (and propagate those up the call stack) ?
what kind of data are you indexing / searching ?