|
From: Leif M. <le...@ta...> - 2006-08-17 02:08:03
|
Matthew,
My guess is that you are attempting to start your child service while the
wrapper's service is still in the "starting" state. I have not tried
this personally,
but it may be that the Windows Service Manager is only capable of starting a
single service at a time.
Have you set up any dependencies in the service configurations between
these services? If ServiceChild depends on ServiceParent, then it would make
sense that ServiceChild could not be started until the startup of
ServiceParent
had completed.
You will probably have to set things up so that you launch a startup thread
which starts the child services AFTER the wrapper's service has completed.
Are you using 3.2.0 or 3.2.1? If so, take a look at the
WrapperManager.sendServiceControlCode method. It can be used to start,
stop and control other services. Note that this method requires that a
SecurityManager be installed in the JVM for security reasons. There are a
number of ways to do this, but adding the following is the simplest:
wrapper.java.additional.1=-Djava.security.manager
wrapper.java.additional.2=-Djava.security.policy=../conf/wrapper.policy
I have attached a sample wrapper.policy file that will give the wrapper.jar
the permissions needed to launch and control your application.
See the documentation for the
org.tanukisoftware.wrapper.security.WrapperServicePermission class.
I strongly suggest only giving permission to control the services that you
want to control. Being able to control any services can open you up to
some major security issues.
wrapper.policy (To start and stop a myservice service)
---
// Give Wrapper classes full permissions
grant codeBase "file:../lib/wrapper.jar" {
permission java.security.AllPermission;
};
// Give Application the permissions that it needs to run. All classes in the
// call stack must have this permission.
grant codeBase "file:../lib/-" {
permission org.tanukisoftware.wrapper.security.WrapperServicePermission
"myservice", "start,stop";
permission org.tanukisoftware.wrapper.security.WrapperServicePermission
"my*", "start,stop";
};
---
Cheers,
Leif
Bec...@em... wrote:
> Hi,
> I wrote an application using integration method 3. As my application
> runs it needs to start other Windows services. I accomplish this by
> exec'ing a "net start". It works fine when my service is started
> manually, but hangs after issuing the net start during automatic
> startup after an OS reboot. After my application fails to start due to
> timeout, the service that it was attempting to start finally starts.
> Increasing the timeout has not helped. It seems that the second
> service does not want to startup until my application has exited.
> Any suggestions on how to make this work would be greatly appreciated.
> Thanks,
> Matthew
|