Jump to content
Excelsior Forums

Windows Services kills VM prematurely

Recommended Posts


  Situation: I have compiled a dll out of the java code that i have written. I have also written some VC++ code to load the dll , call classes/objects in it etc. Everything runs fine.

The Problem: When i convert this program into a windows service (the code for service being written in Vc++) and run it as a service, it runs fine. If i manually stop the service it again stops fine. But if i shutdown the entire machine i notice the win service handler not being called with an event to shutdown. This leads to the OS having to kill the program .

This does not occur if i remove the createJavaVM call.So this points to something that the VM creation does that interferes with the windows service. Any pointers as to if someone else has seen this. How it can be fixed.

The best explanation that i have come up with so far is that

a) The VM created by excelsior on my createJavaVM call, seems to listen for OS System shutdown events in parallel with the Windows services.

B) The VM then shutsdown independent of the windows service that initialized it.

c) This leads to the service hanging and thus having to be killed.

Is this the case if it is any way i can turn off the VM listening for system shutdown events. and allow my program to take care of it..

Share this post

Link to post
Share on other sites