[jboss-user] [Microcontainer] - Re: Programmatic redeploy using DeploymentManager

Juergen.Zimmermann do-not-reply at jboss.com
Mon Feb 9 07:07:54 EST 2009


Thank you! This is exactly what I was looking for.

To summarize: here are the steps for programmatic redeployment with JBossAS 5.0.0.GA:
Context ctx = new InitialContext();
  | ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
  | ctx.close();
  | 
  | DeploymentManager ds = ps.getDeploymentManager();
  | // %JBOSS_HOME%\server\default
  | ds.loadProfile(new ProfileKey("default"), false);
  | 
  | String earName = "foo.ear";
  | String earUrl = "file:/.../foo.ear";
  | 
  | DeploymentProgress stop = ds.stop(ManagedDeployment.DeploymentPhase.APPLICATION, earName);
  | stop.run();
  | checkProgress(stop);
  | 		
  | DeploymentProgress distribute = ds.distribute(earName, ManagedDeployment.DeploymentPhase.APPLICATION, new URL(earUrl), false);
  | distribute.run();
  | checkProgress(distribute);
  | 
  | private static void checkProgress(DeploymentProgress progress) throws Exception {
  |    DeploymentStatus status = progress.getDeploymentStatus();
  |    Throwable failure = status.getFailure();
  |    if (failure != null) {
  |       throw new Exception(failure);
  |    }
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4208163#4208163

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4208163



More information about the jboss-user mailing list