Reputation: 33
I am using JBOSS AS7 and I want to get deployed/running applications in the server with their status deployed/failed using Java or JBOSS API.
Please let me know if any one can help me here.
Thanks in advance.
Bharat.
Upvotes: 0
Views: 1260
Reputation: 33
With all my research i have found the answer. Here is the API https://github.com/jbossas/jboss-as-maven-plugin for getting running apps in server.
After creating the client below code snippet will get the results.
import static org.jboss.as.controller.client.helpers.ClientConstants.CHILD_TYPE;
import static org.jboss.as.controller.client.helpers.ClientConstants.DEPLOYMENT;
import org.jboss.as.controller.client.helpers.Operations;
ModelNode op = Operations.createOperation("read-children-names");
op.get(CHILD_TYPE).set(DEPLOYMENT);
final ModelNode listDeploymentsResult = client.execute(op);
Upvotes: 1
Reputation: 1058
static ModelControllerClient createClient(final InetAddress host, final int port,
final String username, final char[] password, final String securityRealmName) {
final CallbackHandler callbackHandler = new CallbackHandler() {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback current : callbacks) {
if (current instanceof NameCallback) {
NameCallback ncb = (NameCallback) current;
ncb.setName(username);
} else if (current instanceof PasswordCallback) {
PasswordCallback pcb = (PasswordCallback) current;
pcb.setPassword(password.toCharArray());
} else if (current instanceof RealmCallback) {
RealmCallback rcb = (RealmCallback) current;
rcb.setText(rcb.getDefaultText());
} else {
throw new UnsupportedCallbackException(current);
}
}
}
};
return ModelControllerClient.Factory.create(host, port, callbackHandler);
}
Upvotes: 0
Reputation: 479
You will have to use some trick to get your job done. Following are the few options:
JBOSS_HOME/standalone/deployments
folder for files with the name app.war.deployed or app.war.failed.server.log
file in JBOSS_HOME/standalone/log
folder, check for string Deployed "app.war"
. If the string is there, then your application is deployed else not.Upvotes: 0