Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restart a context (webapp) from another webapp

Status
Not open for further replies.

Janoh

Programmer
Jul 20, 2000
34
RO
Hi,

Can I somehow restart my current context from the current app, or another one?
I found somenthing like ContextManager in catalina api, but it doesn't help. I found it in a tomcat's 3.2 internal api
I thought of accessing the tomcat manager to restart my app by calling
but it has authentication and I can not pass by. Another thing is to get somehow the context object and to have a tomcat core wrapper that can operate on it, but I didn't find much and believe me, I've been looking for a week now.
Can I somehow get that context from a JSP/servlet and stop it then start it? All this from another context.

I'm running Tomcat 5.5

Any help or hint is greatly appreciated
 
I managed to do the authentication stuff and call the tomcat manager.
here's the important snippet
Code:
import java.net.Authenticator;
import java.net.PasswordAuthentication;


String urlStr = "[URL unfurl="true"]http://localhost:8080/manager/html/stop?path=/myapp";[/URL]

try {
   Authenticator.setDefault(new ManagerAuthenticator());
   url = new URL(urlStr);
}

public class ManagerAuthenticator extends Authenticator{

  protected PasswordAuthentication getPasswordAuthentication() {
		String user = "user";
		char[] pwd = "password".toCharArray();
		return new PasswordAuthentication(user, pwd);
  }
}

but does anyone have a clue, how could I use the catalina core api?
Did anyone try it with success? I'm doing this temporary workaround and will do some research, if anyone has a link with a quick primer it would be great.

Thanks
JT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top