There is a utility in the NT server resource kit called srvany.exe that
allows any arbitrary program to be installed as a service.  I have used it
in the past to install cmd.exe as a service and provided it with a
commandline that caused it to run a simple batch file.  You could use this
if you like.  There are also other similar third party utilities available
that I have not used.

The one thing that jk_nt_service does that srvany or similar programs will
not do.  When you select to stop the service from the service control panel
or NT is shutting down and tries to stop service the jk_nt_service will use
the ajp12 connector to connect to Tomcat and inform it to shutdown.  Srvany
and it's ilk will simply terminate the process when the stop signal comes.

Perhaps you could place the Tomcat directory on a server drive but configure
it to look on a ClearCase drive for the webapps directory.  This gives you
the best of both worlds though it doesn't address the configuration of
Tomcat itself.  You could if you want have the Tomcat installation itself be
a snapshot view created out of ClearCase which you would have to
occasionally checkin whenever changes were made to it.  You would than have
to refresh the snapshot on other servers if you have multiple servers.

----- Original Message -----
From: Boyce, David <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 24, 2001 9:49 PM
Subject: RE: Tomcat and NT service via wrapper script?


> Keith,
>
> Thanks, I also considered that one for a while previously before realizing
> its fatal flaw. The way ClearCase works, starting a view is analogous to
> mounting a filesystem. Thus the wrapper.properties file (as well as all
the
> other config files, classes, etc.) aren't present till the view starts so
> there's a catch-22.
>
> It comes back to how to run the equivalent of this two-line script:
>
> some.random.program
> tomcat start (or alternatively "java
> org.apache....")
>
> as a service. I don't have MSVC or MSDN so am sort of handcuffed in terms
of
> research but it looks as if the jk_nt_service.exe is written to assume the
> thing it's managing is a java program, Likewise with JavaService and
> javaserv. Does anyone know why it's not possible (apparently) to run a
> script as a service? Why does the service installer/manager/whatever it's
> called need to know what kind of program the service cmd is?
>
> I realize this is drifting away from Tomcat proper so I'll take it
somewhere
> else after this attempt.
>
> David Boyce
>
>
> -----Original Message-----
> From: Keith Gross [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 24, 2001 5:47 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Tomcat and NT service via wrapper script?
>
>
> I haven't done what you're looking to do but I did do a lot of research on
> the NT service wrapper for Tomcat while trying to overcome the user logoff
> problem that JDK 1.3.0 has.  I can see one promising possibility.  The
> service wrapper uses the wrapper.properties file in the conf sub-directory
> to form a command line that is used to launch Tomcat in a separate
process.
> You can see the commandline in the last line of the file.  You could
> possibly rewrite the command line to instead run the command processor
> (cmd.exe) with a batch file that would run your command and than start
> Tomcat.  I'm at home and most of my research was done at work so if you
have
> questions or problems post them and I'll consult my notes at work.
>
> Any number problems could come up with this arrangement.
>
> 1). The way the service wrapper launches the sub-process might prevent the
> command processor from being launched as desired.
> 2). The context your running in (i.e. as a service and under the system
> account) might make interacting with ClearCase difficult.  Pathing and
> security are the two most likely issues here.
> 3). If the ClearCase command takes to long it will causes the service
> manager to think the service has failed and shut things down.
>
> Good luck,
> Keith Gross
>
> ----- Original Message -----
> From: Boyce, David <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 24, 2001 3:48 PM
> Subject: Tomcat and NT service via wrapper script?
>
>
> > Short version: I need to run Tomcat as a service on NT (and know how to
do
> > so) but need a hook to run an arbitrary command as part of the service
> > startup.
> > Details: I'm running Tomcat out of a ClearCase view (for those
unfamiliar,
> > ClearCase is a dynamic filesystem abstraction with a metalanguage
allowing
> > you to specify which versions of files you want to see, e.g. "the state
as
> > of 3:34 PM yesterday" or "my changes but no one else's", etc. But note
> that
> > my problem has nothing to do with ClearCase per se). Running in a view
has
> > many advantages, especially for development, as deployment (or rollback)
> > becomes as simple as changing a line of metalanguage to select newer (or
> > older) versions.
> >
> > However, the use of ClearCase is a red herring; the only concern is that
> the
> > "view" must be started with the command "cleartool startview
<view-name>"
> > before Tomcat runs. I'm doing this on UNIX now and it works just great
> with
> > a little bit of scripting. But I now need to do the same thing on
Windows;
> > unfortunately the whole "service" business there seems pretty
intractable.
> > All I need is a hook to run the startview command prior to Tomcat
startup
> > but I haven't been able to dig up documentation on how or whether it can
> be
> > done.
> >
> > To save time let me enumerate what I don't need: I know how to run
Tomcat
> as
> > a service on NT and have done so successfully. I'm aware of the JDK
1.3.0
> > bug which affects this. I realize that ClearCase (which also runs as a
> > service on NT) must be started prior to Tomcat and have read up on how
to
> > edit service dependencies in the registry. All I still need is a way to
> run
> > an arbitrary command (which happens in my case to be "cleartool
> startview")
> > as part of the service startup sequence. Has anyone done something
> similar?
> >
> > Thanks in advance,
> > David Boyce
> >
>

Reply via email to