YES, damn good idea... I'm looking at it from an embedded tomcat perspective, but yes sounds good, why not use an exposed interface.... I'd love to see the code that gets at those mbeans, never done it before.... if you find an example post it.

----- Original Message ----- From: "Robert Bowen" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Monday, June 25, 2007 5:20 PM
Subject: Re: Programmatically stop/start context (webapp)


Hmmm ... This seems kind of kludgy to me. Would it not be better (easier, more elegant) to use Tomcat's monitoring with JMX to do this? I don't have all the details worked out but I believe that with an MBean I can (at least) monitor the container and the apps running in it and (hopefully) start and stop them as well.

The difficulty I am having is getting a clear and concise guide to using JMX/MX4J in Tomcat 6. There are a bunch of different guides out there that explain how to do this in Tomcat 5, 5.5, 6, and they all contradict themselves!

Anyway, I think this is possible, does it seem like a good idea?

Thanks!
Bob

----- Original Message ----
From: Johnny Kewl <[EMAIL PROTECTED]>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Monday, June 25, 2007 5:07:47 PM
Subject: Re: Programmatically stop/start context (webapp)

Syg, interesting question....

I think, that what would make it tricky, is the actually packaging of the
solution.

In theory if you do this.... (I'm writing this blind, excuse the code)
import org.apache.catalina.ant.*;

StartTask startTask = new StartTask();
startTask.setUsername("admin");
startTask.setPassword("");
startTask.setUrl("http://localhost:8080/manager";;);
startTask.setPath("/ContextOfWebApp");
startTask.execute();

This is actually turned into a URL....request and sent to the manager... so
in theory
if you want to you can just simulate the GET with the required params and
http hdrs.

and a similar thing for stopping it.

Ok, but heres the tricky bit and if you can figure out how to do it in your
dev environment, no problem.

The required jars are in the server main package.... so they will be missing
from your servlet.
To develop you can just drop them in.... BUT then somehow when you actually
package it, you have to take them out.

So... you will probably have to use "late binding".... ie Class.forname or
something, so you can get it working in dev environment and omit the jars in
deployment.
OR.... if you on an App server, just do it in a remote bean.

Anyway, I think its dead easy except for the working around the container
class loader issue.

Try it in a seperate app, think it will be easy.... but when you bring it
into another web-app, the fun will start.

Have fun

----- Original Message ----- From: "syg6" <[EMAIL PROTECTED]>
To: <users@tomcat.apache.org>
Sent: Monday, June 25, 2007 12:40 PM
Subject: Programmatically stop/start context (webapp)



Hello,

I would like to be able to start and stop my 'cache' webapp from my own
'cache-admin' webapp. These two apps usually run on the same Tomcat
instance, but not always.

I am not sure if I should use ManagerServlet or HTMLManagerServlet, or
Embedded tomcat. I have found some examples on this newsgroup and
onjava.com
but was unable to get them to work. Any ideas?

I would also like to somehow (Ajax perhaps) grab the contents of the log
file and display it, updating every 2-3 seconds, in my 'cache-admin'
webapp
when the 'cache' webapp is started/stopped. I am using log4j for logging.

Many thanks for any help!
Bob
--
View this message in context:
http://www.nabble.com/Programmatically-stop-start-context-%28webapp%29-tf3975317.html#a11284321
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to