Q:

JNI, calling Java from C++, SIGSEGV on CallObjectMethod

I have been stuck for a few days on trying to solve problems of calling Java from C++ using JNI.
This is my C++ code. I call a java function which calls C++, and in that C++ function I am trying to call another Java function using the JNIEnv I received.
The error seems to originate at the CallObjectMethod.
JNIEXPORT jbyteArray JNICALL Java_Core_passJavaEnvToCpp(JNIEnv *env, jobject object) {

    jclass myClass = env->FindClass("Core");

    if (env->ExceptionCheck()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
    }
    std::cout << "# 1" << std::endl;
    jmethodID mID = env->GetMethodID(myClass, "retrieveData", "(Ljava/lang/String;)[B");

    if (env->ExceptionCheck()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
    }

    std::cout << "# 2" << std::endl;
    jbyteArray data = (jbyteArray) env->CallObjectMethod(myClass, mID, (jstring)"<location of data>");

    if (env->ExceptionCheck()) {
        env->ExceptionDescribe();
        env->ExceptionClear();
    }
    std::cout << "# 3" << std::endl;

    return data;

}

This is the error I get:
# 1
# 2
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000010ba5dbe6, pid=8193, tid=13063
#
# JRE version: Java(TM) SE Runtime Environment (8.0_25-b17) (build 1.8.0_25-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.dylib+0x30abe6]  Fingerprinter::Fingerprinter(methodHandle)+0x1a
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/.../Downloads/apache-tomcat-8.0.21/bin/hs_err_pid8193.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

This is part of the log report:
    Stack: [0x0000000125c20000,0x0000000125d20000],  sp=0x0000000125d1e640,  free space=1017k
 92 Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
 93 V  [libjvm.dylib+0x30abe6]  Fingerprinter::Fingerprinter(methodHandle)+0x1a
 94 V  [libjvm.dylib+0x30987a]  jni_invoke_nonstatic(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*)+0x244
 95 V  [libjvm.dylib+0x2f9fa3]  jni_CallObjectMethodV+0xf8
 96 V  [libjvm.dylib+0x30d15a]  checked_jni_CallObjectMethodV+0x113
 97 C  [transcoder.dylib+0x10a9]  JNIEnv_::CallObjectMethod(_jobject*, _jmethodID*, ...)+0x189
 98 C  [transcoder.dylib+0xc3e]  Java_Core_passJavaEnvToCpp+0x10e
 99 j  Core.passJavaEnvToCpp()[B+0

Anyone came upon anything similar? I have read about several different possibilities from hardware RAM issues, through JVM version issues and I don't know how to proceed any further.
I will be greatful for any advice.
FIXED:
I should have properly checked the function parameters when I got this process from here.
You have to pass jobject instead of myClass in CallObjectMethod(). Bcoz that method is not a static method to take class object. Its an instance method so pass object of that class. –  Saritha G

A:

Convert like this:
 char *data= (char*)malloc(16);
 strcpy(data, "location of data");
 jstring jstrBuf = env->NewStringUTF(env, data);

Create new instance for your class and pass that object in CallObjectMethod(), instead of passing myClass.

