I guess your Thread can already be attached to the VM, so AttachCurrentThread is not needed. Maybe you just need to check the thread state like this:

How to obtain JNI interface pointer (JNIEnv *)...