commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris S <chriss....@googlemail.com>
Subject [daemon] Problem with starting and stopping a service with prunsrv
Date Wed, 03 Aug 2011 11:57:05 GMT
Hello everybody,

just to to test apache-deamon i have written a simple program, i want to
start and stop it using the jvm mode. There a 3 different problems:

   1. I can't start the service using the windows xp service manager, i get
   an 1053 error, after that the status is "starting"
   2. When i start the service using the "//TS" argument i see my
   application will be started but it the state is still not started when i
   look into the service manager (even after pressing F5 for a refresh)
   3. Using the stop service parameter seems not to work when is start with
   "//TS" , my application seems only to stop when i hit Ctrl+C


 I am able to install my program as service using:
prunsrv //IS//TestService --DisplayName="Test Service" --StartMode=jvm
--StartClass=eu.gemtec.service.Service --StartMethod=start --StopMode=jvm
--StopClass=eu.gemtec.service.Service --StopMethod=stop
--Classpath=servicedummy.jar

I start it using:
prunsrv //TS//TestService

I am using the commons-daemon-1.0.6-bin.zip<http://mirror.arcor-online.net/www.apache.org//commons/daemon/binaries/commons-daemon-1.0.6-bin.zip>
and
Win XP for this test, here is my program source:

public class Service {

 private static final Object lock = new Object();

 public static void start(String[] args) throws InterruptedException {
  System.out.println("Start :"+Arrays.toString(args)+"thread:
"+currentThread());
  synchronized(lock) {
   lock.wait();
  }
 }

public static void stop(String[] args) throws InterruptedException {
  System.out.println("Stop :"+Arrays.toString(args)+"thread:
"+currentThread());
  synchronized(lock){
   lock.notifyAll();
  }
 }
}



Thanks in advance
Christian

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message