Is it possible to programmatically undeploy an ear by using EARDeployer or any other means?
We have a strange requirement in our project as follows-
"We have an EAR file, there has an InitServlet which check some external resources ( like SMS server blah blah ) whether they are available or not while starting the server.
Now I want an application which won't allow application server to deploy the whole EAR file if some external entities are missing. Also if the application is running ( deployed ) and in-between the same external entities becomes unavailable then it should undeploy the whole EAR file and whenever any user try to access the application ( at this time when the application is undeployed ) s/he should get a message that xxx application is unavailable because of XXX problem."
That shouldn't be too bad. If you can do something from the JMX-console, you can do it by invoking methods on the underlying mbeans. You just need to lookup the service you wish to use, from the MBeanServer and invoke. If you're not familiar with MBean concepts, there are some JMX tutorials out there that should help.