Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undeploying apps in JBoss Application Server from the command line

Tags:

jboss

Are there any simple ways to see what wars have been deployed in Jboss AS and undeploy some of them? I want to do this from the command line.

I tried using jmx but I keep getting exception saying "org.jboss.util.NestedRuntimeException: jmx not bound;" I'd prefer to do it in a way where I don't have to stop and start the application server.

like image 392
Joe Avatar asked Dec 09 '11 00:12

Joe


People also ask

How use JBoss command line?

2.1. For Windows Server, use the EAP_HOME\bin\jboss-cli. bat script to launch the management CLI. See Connect to the Server for details on launching the management CLI and connecting to the server in one step using the --connect argument. The jboss-cli scripts set the com.

Which command is used to undeploy the application in JBoss?

Undeploy an Application in a Standalone Server Using the Management CLI. By default the undeploy command will undeploy and delete the deployment content from a standalone instance of JBoss EAP.

How do you undeploy ears in JBoss?

Type 'connect' to connect to the server or 'help' for the list of supported commands. Instruct the API to connect (this can also be passed at runtime as ./jboss-admin.sh --connect ). Run the undeploy command to display available applications. Run the undeploy command to undeploy the application.

Which of the following command is used to undeploy the application?

Use the BPMUndeploy command in connected mode to undeploy a process application snapshot from a Process Center or Process Server.


1 Answers

You can approach this in three ways in JBoss Application Server 7:

  • Management Console
  • Management CLI
  • Deployment folder

Management Console

Being a GUI, the Management Console is the most visual of the three, and you can see the list of deployed applications under the Deployment window. You have the option to Disable and Remove the deployed applications listed here. This screenshot is from AS7.0.2, and some windows have and will change with the addition of tabs, but the general functionality remains the same.

Imgur

Management CLI

The Management Command Line Interface is a new addition to AS7. The CLI exposes a lot of low-level functionality, and is a powerful tool once you get familiar with the commands and operations. As you might expect, you can run help to show the commands, or run <commandname> --help for more information on a specific command. Two useful commands are deploy and undeploy, so let's look at their help information. I'll give Linux examples, but you can insert your flavour of OS as required.

Here's deploy:

[standalone@localhost:9999 /] deploy --help
SYNOPSIS

    deploy (file_path [--name=deployment_name] [--runtime_name=deployment_runtime_name] [--force] | --name=deployment_name) [--server-groups=group_name (,group_name)* | --all-server-groups]

DESCRIPTION

    Deploys the application designated by the file_path or enables an already existing
    but disabled in the repository deployment designated by the name argument.
    If executed w/o arguments, will list all the existing deployments.

ARGUMENTS

 file_path           - the path to the application to deploy. Required in case the deployment
                       doesn't exist in the repository.
                       The path can be either absolute or relative to the current directory.

 --name              - the unique name of the deployment. If the file path argument is specified
                       the name argument is optional with the file name been the default value.
                       If the file path argument isn't specified then the command is supposed to
                       enable an already existing but disabled deployment, and in this case the
                       name argument is required.

 --runtime_name      - optional, the runtime name for the deployment.

 --force             - if the deployment with the specified name already exists, by default,
                       deploy will be aborted and the corresponding message will printed.
                       Switch --force (or -f) will force the replacement of the existing deployment
                       with the one specified in the command arguments.

 --server-groups     - comma separated list of server group names the deploy command should apply to.
                       Either server-groups or all-server-groups is required in the domain mode.
                       This argument is not applicable in the standalone mode.

 --all-server-groups - indicates that deploy should apply to all the available server groups.
                       Either server-groups or all-server-groups is required in domain mode.
                       This argument is not applicable in the standalone mode.

 -l                  - in case none of the required arguments is specified the command will
                       print all of the existing deployments in the repository. The presence of the -l switch
                       will make the existing deployments printed one deployment per line, instead of
                       in columns (the default).

And here's undeploy:

[standalone@localhost:9999 /] undeploy --help
SYNOPSIS

    undeploy name [--server-groups=group_name (,group_name)* | --all-relevant-server-groups] [--keep-content]

DESCRIPTION

    Undeploys the deployment with the given name and, depending on the arguments, removes
    its content from the repository.
    If the deployment name isn't specified, prints the list of all the existing deployments.

ARGUMENTS

 name                   - the name of the deployment to undeploy.

 --server-groups        - comma separated list of server group names the undeploy command should apply to.
                          Either server-groups or all-relevant-server-groups is required in the domain mode.
                          This argument is not applicable in the standalone mode.

 --all-relevant-server-groups   - indicates that undeploy should apply to all the server groups
                                  in which the deployment is enabled.
                                  Either server-groups or all-relevant-server-groups is required in domain mode.
                                  This argument is not applicable in the standalone mode.

 --keep-content         - by default undeploy, besides disabling the deployment, also removes its
                          content from the repository. The presence of --keep-content will only disable
                          the deployment w/o removing its content from the repository.
                          This argument can be used in both standalone and domain modes.

 -l                     - in case the deployment name isn't specified, the presence of the -l switch
                          will make the existing deployments printed one deployment per line, instead of
                          in columns (the default).

The CLI In Action

Running the deploy or undeploy command without any arguments will list all the applications available. So your workflow to log in to the CLI and undeploy an application would be like this (simplified):

Change directory from EAP_HOME to the bin folder:

[user@home EAP_HOME]$ cd bin

Run the CLI logon script:

[user@host bin]$ ./jboss-admin.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.

Instruct the API to connect (this can also be passed at runtime as ./jboss-admin.sh --connect).

[disconnected /] connect
Connected to standalone controller at localhost:9999

Run the undeploy command to display available applications.

[standalone@localhost:9999 /] undeploy
test.ear

Run the undeploy command to undeploy the application. In this case, the test.ear.

[standalone@localhost:9999 /] undeploy test.ear
Successfully undeployed test.ear.

Deployment Folder

If you are running an instance of AS7 as a development tool, and are using the deployment folder, you can simply delete the application. You will notice that a marker file is created, such as test.ear.failed, to signify the status of the application deployment.

like image 94
ddri Avatar answered Oct 13 '22 18:10

ddri