AbeL
Posts: 2
Joined: Tue Nov 01, 2005 10:12 am

Java service hangs on stop

Hi there,

I created an installer for a Java service. The installer works fine and so does the service.

But every time I want to stop the service/uninstall the application, the service hangs on being stopped. I can only terminate it using kill.exe from Resource Tools.

The Application has a stop() method which calls System.exit(0). The installer is set to automatically start the service on install and stop it on uninstall.

Has anyone experienced or fixed this problem?


Thanks in advance,
AbeL
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Please ensure that your application is closed correctly. The "System.exit(0)" is not recommended to close your application if you have more that one thread started.

Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
aranzuglia
Posts: 2
Joined: Tue Oct 03, 2006 7:47 pm

stop() method

Hi

I cannot understand the stop() method. How should we write it?

The tutotial says:

Code: Select all

public static void main(String[] args) ...
and

Code: Select all

public static void stop() ...
The compiler complains about the overriding method, the original stop() isn't static

Without static it complains because the original stop() is final

When I stop the service, it complains with NoSuchMethodError, so it is looking for it

So, how does it have to be written?

Thanks
aranzuglia
Posts: 2
Joined: Tue Oct 03, 2006 7:47 pm

Sorry, my class extends Thread, solved

Return to “Common Problems”