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

从命令行取消部署JBoss Application Server中的应用程序,jboss,Jboss,有没有简单的方法可以查看Jboss中部署了哪些战争并取消部署其中的一些?我想从命令行执行此操作 我尝试过使用jmx,但我总是遇到异常,说“org.jboss.util.NestedRuntimeException:jmx not bound”;我更喜欢这样做,不必停止和启动应用服务器。使用jboss应用服务器,可以在deploydir中处理wars/ear上的简单文件操作部署 只需ls进行枚举,delete取消部署,copy进行部署,touch进行重新部署。不需要重新启动服务器 对于最新版本的J

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


我尝试过使用jmx,但我总是遇到异常,说“org.jboss.util.NestedRuntimeException:jmx not bound”;我更喜欢这样做,不必停止和启动应用服务器。

使用jboss应用服务器,可以在
deploy
dir中处理wars/ear上的简单文件操作部署

只需
ls
进行枚举,
delete
取消部署,
copy
进行部署,
touch
进行重新部署。不需要重新启动服务器


对于最新版本的JBoss Application Server 7,您也可以使用。

您可以通过以下三种方式实现这一点:

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

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

这里有
部署

[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).
[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).
下面是
取消部署

[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).
[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正在运行 不带任何参数运行
deploy
undeploy
命令将列出所有可用的应用程序。因此,登录到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
传递)

运行“取消部署”命令以显示可用的应用程序

[standalone@localhost:9999 /] undeploy
test.ear
运行undeploy命令以取消部署应用程序。在本例中,test.ear

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

您也可以尝试CLI GUI。部署-->取消部署菜单选项提供部署的选择列表。点击几下就完成了


请参见

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

文章()完美地解释了它的工作原理

如果您对此有任何疑问,请告知所有人


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

因此,如果我删除旧的WAR,它们将自动取消部署?我用文档验证了您的答案。我现在问这个问题觉得很傻。但是我不知道它是这样工作的,我猜它是如此的微不足道以至于被人们提到。乔,这些都是很好的问题,它们不会被忽视。就这些?该死。请注意,
jboss admin.sh
脚本现在在as 7和EAP 6的更高版本中重命名为
jboss cli.sh