views:

110

answers:

1

My question is basically the flip side of a previous question I asked.

Is there a way to destroy (and then re-create) a (the?) ServletContext of a web application? Basically I'm trying to programmatically do whatever JBoss does to re-initialized the ServletContext - or just tell JBoss to do it for me.

+1  A: 

In JBoss 4.x, you can programmatically interact with JBoss's deployer using the jboss.system:service=MainDeployer MBean. It's rather cumbersome, though, you have to talk to it using deployment URLs, which are a rather elaborate file:// syntax.

Using this, though, you can tell JBoss to undeploy/deploy/redeploy any given application (even having an application redeploy itself, which is rather nifty).

skaffman
I'm using JBoss 5. Can I use that MBean the same way? Sorry - the JBoss5.x tag was on the older question I asked.
Matt Ball
I'm not familiar with v5 yet. Have a poke around on the JMX console, there's bound to be something very similar.
skaffman