With JBoss AS 7 Command Line Interface (CLI) has been introduced. Using CLI one can connect to the AS7 domain controller as well as to a standalone server and execute management operations like deploy, undeploy applications, create/delete queue, create/delete topics, create/delete data sources etc. In earlier release JBoss used to have twiddle commands however the changes made it used to not be persistence if we restart the servers all the changes made using twiddle commands would not be taken which is not in the case of CLI.

Hence in this article we would be concentrating on the deployment and undeployment of the application in domain and standalone mode. Before running the deploy commands make sure you have connected to respective running JBoss AS 7 servers in standalone or domain mode using the below connect command. You should run all these commands from the /bin folder.

To see how to connect JBoss AS 7 using CLI do have a look at the article 4 ways to connect JBoss AS 7 using CLI

Standalone mode

In standalone mode we have one server on which we have to deploy the application hence following are the options for it

Deploy an application

To deploy an application you need to use the below deploy command and give the full path with the application which has to be deployed.

deploy /<PATH>/TestApp.war

example:

[standalone@localhost:9999 /]deploy /home/urs/WebApps/TestApp.war
'TestApp.war' deployed successfully.

Undeploy an applicaiton

To undeploy an application you need to use the below undeploy command with the deployed application name.

[standalone@localhost:9999 /] undeploy TestApp.war
Successfully undeployed TestApp.war.

Deploy an application which is disabled

If you want to deploy an application but do not want to enabled then you can use the below command

deploy /<PATH>/TestApp.war --disabled

example:

[standalone@localhost:9999 /]deploy /home/urs/WebApps/TestApp.war --disabled
'TestApp.war' deployed successfully.

Enable the already deployed application

If you want to enable the application which is already been deployed you can use the below command.

[standalone@localhost:9999 /] deploy --name=TestApp.war
'TestApp.war' deployed successfully.

Note: Make sure you given the –name or else you JBoss will assume its a new application.

Disable the application BUT without removing it

If you want to just disable the deployed application and do not want to remove it you can use the below command

[standalone@localhost:9999 /] undeploy TestApp.war --keep-content
Successfully undeployed TestApp.war.

Note: Make sure you have given –keep-content or else the application would be removed.

Domain mode

When trying to deploy an application in domain mode then it becomes little bit tricky as we are dealing with multiple servers at a time, hence following are the options which has be concentrated on the server groups

Deploy an application to all server groups

If you want to deploy an application to all server groups you can use deploy command with path of the application and “–all-server-groups” option

deploy /<PATH>/TestApp.war --all-server-groups

example:

 

[domain@localhost:9999 /] deploy /home/urs/WebApps/TestApp.war --all-server-groups
'TestApp.war' deployed successfully.

Undeploy an application from all server groups

If you want to undeploy an application from all server groups you can use the below command

[domain@localhost:9999 /] undeploy TestApp.war --all-relevant-server-groups
Successfully undeployed TestApp.war.

Undeploy from a particular server group

If you want to undeploy an application from a particular server groups you can use the below command

[domain@localhost:9999 /] undeploy TestApp.war --server-groups=main-server-group --keep-content
Successfully undeployed TestApp.war.

Note: Use “–keep-content” or else you would get the below error

[domain@localhost:9999 /] undeploy TestApp.war --server-groups=main-server-group
Undeploy failed: {"domain-failure-description" => {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-3" => "Cannot remove deployment TestApp.war from the domain as it is still used by server groups [other-server-group]"}}}

Deploy to a particular server group

If you want to deploy an application from a particular server groups you can use the below command which has the option –server-groups

deploy /<PATH>/TestApp.war --server-groups=main-server-group

example:

[domain@localhost:9999 /] deploy /home/urs/WebApps/TestApp.war --server-groups=main-server-group
Successfully deployed TestApp.war.

Deploy the same application to other server group

Now if the application is already been deployed to one server group and you want it to deploy the same application on the other server group you can do it using the below command.

[domain@localhost:9999 /] deploy --name=TestApp.war --server-groups=other-server-group
'TestApp.war' deployed successfully.

Note: Use “–name” or else you would get the below message

'TestApp.war' is already deployed (use --force to force re-deploy).

Deploy an application which is disabled

If you want to deploy an application but do not want to enabled then you can use the below command

deploy /<PATH>/TestApp.war --disabled

example:

[domain@localhost:9999 /] deploy /home/urs/WebApps/TestApp.war --disabled
'TestApp.war' deployed successfully.
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.