tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warner Onstine" <war...@warneronstine.com>
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
command.

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?

-warner
----- Original Message -----
From: "Craig R. McClanahan" <Craig.McClanahan@eng.sun.com>
To: <tomcat-dev@jakarta.apache.org>
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
asked
> > to start, but am running into some difficulties when attempting to shut
it
> > 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
of
> > server.xml, and then the server.start() command (which works properly),
with
> > 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
messed
> with this flag?
>
> Other than that, it sounds like you're doing exactly what the standard
startup
> stuff does.
>
> One possible approach -- you could actually call the main() method of
> org.apache.catalina.startup.Catalina yourself (from within the new thread)
and
> you wouldn't have to do anything special.  All you need is to fake the
command
> 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 <http://www.apachecon.com>!
> 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: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>


Mime
View raw message