Problem with CLI Undeploy
bsudhananthan Aug 24, 2012 9:06 AMI've started jboss 7 server with following configuration
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-enabled="true" scan-interval="5000" auto-deploy-zipped="false" auto-deploy-exploded="false"/>
</subsystem>
so the deployment of modules gets started only when user placed marker file (or) initiated it via command line.
I deployed my myapp.ear application programatically(using CLI) when the server gets started. I achieved this by writing a service by extending org.jboss.msc.service.Service, created "deploymentController.jar" and placed under standalone/deployments/ for controlling "myapp.ear" deployment.
Note: deploymentController.jar will be deployed automatically when server starts(marker file for specific jar is placed).
the deployment code is something like :
client = ModelControllerClient.Factory.create(InetAddress.getLocalHost().getHostAddress(), 9999);
manager = ServerDeploymentManager.Factory.create(client);
final DeploymentPlanBuilder builder = manager.newDeploymentPlan();
final DeploymentPlan plan;
FileInputStream archile = new FileInputStream(jbossDeploymentPath+"myapp");
plan = builder.add("clust.ear",archile).deploy("clust.ear").build();
And above code is written in start() method of myService which extends org.jboss.msc.service.Service which will automatically called when deploymentController.jar gets deployed.
The issue is with Undeploying of "myapp.ear". I want to undeploy "myapp.ear" when server gets down, i wrote undeploy logic similar to above code in stop() method of myService which extends org.jboss.msc.service.Service. But the connection gets closed when control moves to stop() method so i it fails.
CLI deploy not gets undeployed automatically when server gets down.
My requirement is to undeploy the deployed modules i.e made via CLI, when the server gets down.
please give me the solution to achieve this in a gracefull manner.
Thanks a lot in advance,
Sudhananthan B.