Andy, thanks for the hint. It seems like the right solution for our
problem.

We had to get this working by today, so we ended up extending Embedded
class and provided shutdown hooks just like Catalina class does, but
without requiring server.xml configuration. Using the new class we can
start a tomcat instance and shutdown a remote tomcat instance by sending
a shutdown command to a certain host and port.
Thanks everybody for your help.

Regards.

Oleg

-----Original Message-----
From: andy gordon [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 15, 2005 5:16 AM
To: Tomcat Users List
Subject: RE: Re: starting and stopping Tomcat from Java code

Oleg, 
   
  Have you looked into managing the tomcat instance with MBeans. All you
need to do is establish a connection to the other JVM with an
MBeanServerConnection instance. This does require a port to be exposed
from Tomcat for remote monitoring. But once you have the connection you
can do what you want with the remote Tomcat. Just look at how JConsole
monitors/manages remote JVM applications for an example.
   
  HTH 
   
  - andy

Oleg Lebedev <[EMAIL PROTECTED]> wrote:
  Yes, that would work if I had a handle to the embedded instance. The
thing is that embedded tomcat is running in a separate VM and I need to
be able to shut it down. I don't really need to use Embedded class if
only I could get Bootstrap or Catalina classes to work without having to
have the whole tomcat directory on disk.


-----Original Message-----
From: news on behalf of Bill Barker
Sent: Wed 12/14/2005 8:14 PM
To: users@tomcat.apache.org
Subject: Re: starting and stopping Tomcat from Java code

Urm, something like:
tomcat.stop();

where 'tomcat' is your Embedded instance?

"Oleg Lebedev" wrote in message
news:[EMAIL PROTECTED]
Hello,

I am trying to configure, start and then shutdown Tomcat from my Java
class. I am planning to have all the jars required by Tomcat on the
classpath and I would like to be able to specify the port number and
host using method calls. I would prefer not to ship Tomcat configuration
files, such as server.xml with my application and be able to configure
Tomcat from code before starting it.

I tried using Boostrap class, but it requires catalina.home and
catalina.base, which I would like to avoid using.
I tried using Embed class and it worked, but I still had to set
catalina.home so that it can find tomcat-users.xml. But, this is
acceptable.

I have not been able to shut Tomcat down from my Java code. Note that I
won't have a handle to the Catalina instance started, because Tomcat
needs to be started before my application starts in a separate VM, and
then killed when my application exists.

I would appreciate any feedback on how to do this or what Tomcat classes
I should take a look at.

Thanks.

Oleg





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
If you have questions about this email, please contact the IT Help Desk.

Mail



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


                        
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping
--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
If you have questions about this email, please contact the IT Help Desk.

Mail


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to