How to run Tomcat on Windows ?
Rod Widdowson
rdw at steadingsoftware.com
Thu Jul 28 05:19:12 EDT 2016
Having written all the below I was suddenly struck: why you need to use
either catalina.bat or tomcat.exe? You are presumably using some other
technology to start jetty. Tomcat is just another java program so why can
you not do the same thing there?
But anyway:
> Do you have a recommendation/preference/suggestion regarding how to
> run Tomcat on Windows ? (catalina.bat vs tomcat.exe)
"About as long as a piece of string".
For the sake of simplicity and not cluttering things up and being able to
control the java exactly, I'd suggest catalina.bat. The whole service thing
brings its own complications.
But you say that you are having problems killing catalina.bat (presumably
from another command prompt?). ISTR that this is a known weak point with
Tomcat (others will confirm) and you might be best finding some tool to send
a (metaphorical) SIGHUP to the java process.
On the other hand the tomcat.exe (which is also what we call shibd_idp.exe
and is really called procrun.exe) has some advantages - not least that you
can use it to run both Tomcat and Jetty just by changing its
parameterization (or even its name - the parameterization is keyed off the
executable name). With a following wind you will be able to shift the java
it points to around (7 or 8 or 9, 32 or 64bit). Annoyingly, as others have
mentioned, you need to track updates to because Oracle move the installation
location with each upgrade and only care about java.exe being up to date.
Procrun.exe does have an "auto" setting which I haven't been able to fully
bottom out.
> [And if the executable is preferred over the bat, I'm
> wondering if setenv.bat is still called, because that's how I was
> setting idp.home. ]
No, it isn't called: all the configuration is via the registry (a sort of
system wide database for configuration of Windows applications, behaviour,
drivers, and everything else). Setting this up is what would allow us to
run Jetty or Tomcat with the same executable.
> I would imagine that most people run Tomcat on Windows as a service.
That is a pretty important point, I'd be surprised if the running as a
service bit would make any difference but it might. Primarily however I'd
suggest that you be driven by ease of deployment and maintenance (and being
able to stop the container).
I guess I'd suggest that you play with tomcat.exe and see whether it answers
what you need, specifically whether you can stop the process. I'd note
that once you have installed tomcat you don't need to go through the whole
rigmarole of starting service you can just say "tomcat.exe run" for
debugging purposes.
If it answers your need (particularly if it stops cleanly) then contact me
off line and we'll see about moving all the container testing to procrun.
As I type this it occurs to me that there is something very appealing about
being able to say
C:\> SC START IDP_TOMCAT_JAVA8
At the start of a run and
C:\> SC STOP IDP_TOMCAT_JAVA8
At the end.
You could introduce other containers/java versions/IDP_home locations as the
whim takes you and just give them a different name. (idp_jetty_java8) And
of course all of these can share the same %{idp.home}
Rod
More information about the dev
mailing list