tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warner Onstine" <>
Subject Re: running tomcat in a thread
Date Tue, 19 Sep 2000 19:38:32 GMT
OK, see if this makes sense (and you can tell me where we're wrong ;-).

First assumption: org.apache.catalina.startup.Catalina was designed to be
run from two different jvm instances.
Second assumption: due to this fact, you do not have access to the original
server instance, so therefore must create your own using createStopMapper

Now once you have a server instance (almost ?) identical to the first you
can now grab the shutdown and port information to send it the shutdown

Herein lies our problem I believe (and I will tell you our fix and see if it
is the most optimal). When running initialize() as its own thread it has a
copy of server. When terminate() is called it attempts to change the value
of server via the createStopMapper and its setServer method. The second
server instance never gets created properly and therefore the message:

Lifecycle Exception: This server has not yet been started.

Now here is how we got around it - simply remmed out the section on
xmlMapper and use the current instance of server.

Does any of this sound right?

----- Original Message -----
From: "Craig R. McClanahan" <>
To: <>
Sent: Tuesday, September 19, 2000 12:13 PM
Subject: Re: running tomcat in a thread

> Warner Onstine wrote:
> > Hi all,
> > I am attempting to get Tomcat [Catalina] to run in its own thread when
> > to start, but am running into some difficulties when attempting to shut
> > down.  I am receiving the following message upon attempted shutdown:
> >
> > Lifecycle Exception: This server has not yet been started.
> >
> > I have an initialize() method start the thread with all of the parsing
> > server.xml, and then the server.start() command (which works properly),
> > the appropriate server.await() command (almost identical to
> > org.apache.catalina.startup.Catalina). Now what is happening when the
> > terminate() method is called is the exception above.
> >
> That's odd.  The only place that error happens is in
StandardServer.stop(), and
> only if the "started" flag is false (it is set to true when you execute
> StandardServer.start()).  Is there any chance that something else has
> with this flag?
> Other than that, it sounds like you're doing exactly what the standard
> stuff does.
> One possible approach -- you could actually call the main() method of
> org.apache.catalina.startup.Catalina yourself (from within the new thread)
> you wouldn't have to do anything special.  All you need is to fake the
> line arguments that normally get sent (either "start" or "stop" as the
only one)
> and you would be using all the normal stuff.
> >
> > Any ideas?
> >
> > -warner
> >
> Craig
> ====================
> See you at ApacheCon Europe <>!
> Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
> Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
>                                     Applications to Tomcat
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message