JVM crash during termination of COM DLL via JNI
Hi folks,
I have a curly problem with a JNI interface to a 3rd party COM DLL.
My JNI (C++) class is simply a wrapper to methods in the COM DLL I need exposed to Java. The problem I have occurs when shutting down the COM DLL... but, I only get the problem when running the java app via an NT Service wrapper.
The JVM error I get:
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1900507f, pid=420, tid=3796
#
# Java VM: Java HotSpot(TM) Server VM (1.5.0_09-b01 mixed mode)
# Problematic frame:
# C [JSAVI2.dll+0xb507f]
The JSAVI2.dll is my JNI class.I have narrowed down the portion of the C++ code which seems to be crashing the JVM:
if( pSAVI && pSAVI != NULL){
// unload
pSAVI->Terminate();// crash here
pSAVI->Release();
pSAVI = NULL;
}
// Unload savi itself
CoUninitialize();
pSAVI is astatic reference to an instance of ISavi3 which is a class defined in the 3rd party DLL.
When running this in straight java land, everything works fine. When I run this from within an NT Service wrapper (I have tried the Java Service Wrapper from Tanuki, and the JavaService component from ObjectWeb); the JVM crashes at this point.
Initially I thought that it may be a problem with the NT Service wrapper, but since I have tried two different ones I am questioning this theory.
I am running:
Windows XP Pro (32 bit, fully patched etc)
JDK: 1.5.0_09-b01
Have tried both the client and server jvm.dll and tried disabling HotSpot, all of which result in the same problem.
Initialisation of the COM DLL works fine, it's just the termination that barfs.
I'm running out of options....
Anyone got any ideas?

