Name: gm110360 Date: 09/10/2003
FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Initially discovered on J2SE 1.4.1, reproduced with the latest J2SE.
Reported in the "Native Methods" Forum (with no replies): http://forum.java.sun.com/thread.jsp?forum=52&thread=437693
I found an occurrence of the same problem reported to Win2000/1.4.0 as well: http://forum.java.sun.com/thread.jsp?forum=52&thread=338124
A DESCRIPTION OF THE PROBLEM :
When called from a DLL, JNI_CreateJavaVM() never returns.
Executing JNI_CreateJavaVM() with the same initialization from the main application works as expected.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Reproduceable:
//////////////////////////////////////////
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <jni.h>
#include <memory.h>
JavaVM* jvm;
JNIEnv* env;
void CreateVM()
{
JavaVMInitArgs args;
JavaVMOption options[1];
memset(&args, 0, sizeof(args));
args.version = JNI_VERSION_1_4;
args.nOptions = 1;
options[0].optionString = "-Djava.class.path=<classpath>";
args.options = options;
args.ignoreUnrecognized = JNI_FALSE;
//JNI_CreateJavaVM(&jvm, (void **)&env, &args);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateVM();
break;
}
return TRUE;
}
//////////////////////////////////////////
Executing the above CreateVM() method from the main application works as expected.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JNICreateJavaVM() should initialize the VM
ACTUAL -
Process hangs in call to JNI_CreateJavaVM()
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
See "Steps to reproduce" above.
Create a DLL from the supplied code.
---------- END SOURCE ----------
(Incident Review ID: 200738)
======================================================================