I have a java class which executes Solr query and prints the output , which
is working perfectly well .
I am using EmbeddedSolrServer , snippet is below :
String solrDir =
"/Users/TheRoot/Downloads/solr-4.7.0/example/solr/";
CoreContainer container = new CoreContainer(solrDir);
container.load();
EmbeddedSolrServer server = new EmbeddedSolrServer(container,
"collection1");
ModifiableSolrParams solrParams = new ModifiableSolrParams();
solrParams.add(CommonParams.Q, "*:*");
QueryResponse queryResponse = null;
try {
queryResponse = server.query(solrParams);
} catch (SolrServerException e) {
e.printStackTrace();
}
for (SolrDocument document : queryResponse.getResults()) {
System.out.println(document.getFieldValueMap().toString());
}
server.shutdown();
container.shutdown();
But when I try to access main from my C code , it throws error saying :
*Invalid memory access of location 0x0 rip=0x109fbdfac*
When I comment out
try {
queryResponse = server.query(solrParams);
} catch (SolrServerException e) {
e.printStackTrace();
}
for (SolrDocument document : queryResponse.getResults()) {
System.out.println(document.getFieldValueMap().toString());
}
error is not thrown .
My C code snippt is below :
EmbeddedSolrExample_Class = (*env)->FindClass(env,
"EmbeddedSolrExample");
main_method = (*env)->GetStaticMethodID(env,
EmbeddedSolrExample_Class, "main", "([Ljava/lang/String;)V");
(*env)->CallStaticVoidMethod(env, EmbeddedSolrExample_Class,
main_method, NULL);
*Although I am able to access and get output from other functions from the
java class . *