Jon Baer wrote:
> I have read the documentation inside class catalina.startup.Embedded but dont
> quite understand the process as I would like to create a seperate method by
> which to *start* and *stop* a server/engine at any time from this GUI.
>
That is not really what the Embedded class is for -- there is a directory "service"
in the source tree that contains the beginnings of an API for
operating-system-independent start and stop type things. It hasn't been completely
fleshed out yet.
If all you want to do is start and stop an external instance of Tomcat, you don't
need the embedded class at all. Just fire off a shell process that executes the
appropriate start or stop command.
On the other hand, if you want to start the Tomcat instance that your servlet-based
GUI application is running in, you have something of a chicken-and-egg situation
:-). I solved this for hot deployment of new webapps by making the "manager"
application a separate webapp.
>
> However, my server application is actually a web application inside (servlets).
> Is there a way or documentation on how to embedded and configure this from
> within another app or can someone show what below means and how I can accomplish
> the same thing. Thanks.
>
Embedded is best used where you want to start and stop Tomcat, within the context of
an existing (long-running) server process like an application server.
Among others, the J2EE reference implementation will be using this API to start and
stop its web service (which uses Tomcat 4.0) from its command console. Basicially,
their code looks a lot like the example main() method at the bottom of the Embedded
class, except that the values used come from configuration settings established in
their GUI rather than being constants. The main() method will actually run, if you
execute
$CATALINA_HOME/bin/catalina.sh embedded
and creates a runtime environment very similar to the one built from the standard
server.xml file. It will run for two minutes, and then shut down -- in a real world
case, you would probably leave the embedded environment running until you shut down
the surrounding application (or until a command to shut down web serving was given
via the GUI).
Besides the basics of starting and stopping, you might want to consider creating
your own implementation of the Logger interface, and have it write to whatever log
files the rest of your application creates. The example main() method just uses a
SystemOutLogger to log to standard output.
More details than this depends a lot on the particulars of your requirements.
>
> - Jon
>
Craig McClanahan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]