从命令行在JBoss Application Server中取消部署应用程序

时间:2011-12-09 00:26:07

标签: jboss

有没有简单的方法可以看到在Jboss AS中部署了哪些战争并取消部署其中一些?我想从命令行执行此操作。

我尝试使用jmx,但我一直得到异常,说“org.jboss.util.NestedRuntimeException:jmx not bound;”我宁愿这样做,我不必停下来启动应用程序服务器。

4 个答案:

答案 0 :(得分:30)

您可以在JBoss Application Server 7中以三种方式处理此问题:

  • 管理控制台
  • 管理CLI
  • 部署文件夹

管理控制台

作为GUI,管理控制台是三者中最直观的,您可以在“部署”窗口下看到已部署应用程序的列表。您可以选择禁用和删除此处列出的已部署应用程序。这个截图来自AS7.0.2,一些窗口已经并且将随着标签的添加而改变,但是一般功能保持不变。

Imgur

管理CLI

管理命令行界面是AS7的新增功能。 CLI公开了许多低级功能,一旦熟悉了命令和操作,它就是一个强大的工具。正如您所料,您可以运行help来显示命令,或运行<commandname> --help以获取有关特定命令的更多信息。两个有用的命令是deployundeploy,所以让我们看看他们的帮助信息。我将给出Linux示例,但您可以根据需要插入您的操作系统。

这是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).

这里是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).

CLI In Action

运行不带任何参数的deployundeploy命令将列出所有可用的应用程序。因此,登录CLI并取消部署应用程序的工作流程就像这样(简化):

将目录从EAP_HOME更改为bin文件夹:

[user@home EAP_HOME]$ cd bin

运行CLI登录脚本:

[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.

指示API进行连接(这也可以在运行时以./jboss-admin.sh --connect传递)。

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

运行undeploy命令以显示可用的应用程序。

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

运行undeploy命令取消部署应用程序。在这种情况下,test.ear。

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

部署文件夹

如果您正在运行AS7的实例作为开发工具,并且正在使用部署文件夹,则只需删除该应用程序即可。您将注意到创建了一个标记文件,例如test.ear.failed,以表示应用程序部署的状态。

答案 1 :(得分:3)

使用JBoss Application Server,可以在deploy目录的战争/耳朵上处理普通文件操作的部署。

只需ls枚举,delete取消部署,copy部署和touch重新部署。无需重启服务器。

另外,对于最新版本的JBoss Application Server 7,您可以使用CLI

答案 2 :(得分:2)

您也可以尝试使用CLI GUI。 Deployments - &gt; Undeploy菜单选项提供部署选择列表。点击几下即可完成。

请参阅https://community.jboss.org/wiki/AGUIForTheCommandLineInterface

答案 3 :(得分:0)

如果删除应用程序取消部署的WAR和EAR,则不必重新启动JBOSS服务器。

文章(http://docs.jboss.org/jbossas/docs/Clustering_Guide/4/html/clustering-intro-farm.html)给出了它如何运作的完美解释。

如果您对此有任何疑问,请大家知道。

我们在DEV,QA和Prod环境中以相同的方式在Jboss上进行开发,到目前为止还没有遇到任何问题。