When the machine is logged off though, the COM+ dll stops running.
If i comment out the call to JNI_CreateJavaVM, the COM+ dll remains
running on log out.
You need to pass the -Xrs (Reduce Signals Xtended-switch) parameter to
the JVM (131 or higher).
From the doc :
<
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html>
-Xrs
Reduces usage of operating-system signals by the Java virtual machine
(JVM). This option is available beginning with J2SE 1.3.1.
In J2SE 1.3.0, the Shutdown Hooks facility was added to allow orderly
shutdown of a Java application. The intent was to allow user cleanup code
(such as closing database connections) to run at shutdown, even if the
JVM terminates abruptly.
The JVM watches for console control events to implement shutdown
hooks for abnormal JVM termination. Specifically, the JVM registers a
console control handler which begins shutdown-hook processing and returns
TRUE for CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and
CTRL_SHUTDOWN_EVENT.
The JVM uses a similar mechanism to implement the pre-1.2 feature of
dumping thread stacks for debugging purposes. Sun's JVM uses
CTRL_BREAK_EVENT to perform thread dumps.
If the JVM is run as a service (for example, the servlet engine for a
web server), it can receive CTRL_LOGOFF_EVENT but should not initiate
shutdown since the operating system will not actually terminate the
process. To avoid possible interference such as this, the -Xrs command-
line option has been added beginning with J2SE 1.3.1. When the -Xrs
option is used on Sun's JVM, the JVM does not install a console control
handler, implying that it does not watch for or process CTRL_C_EVENT,
CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT.
There are two consequences of specifying -Xrs:
* Ctrl-Break thread dumps are not available.
* User code is responsible for causing shutdown hooks to run, for
example by calling System.exit() when the JVM is to be terminated.
Bye.