gpt4 book ai didi

jboss - 从命令行取消部署 JBoss 应用程序服务器中的应用程序

转载 作者:行者123 更新时间:2023-12-02 05:18:51 27 4
gpt4 key购买 nike

是否有任何简单的方法可以查看 Jboss AS 中部署了哪些 war 并取消部署其中一些 war ?我想从命令行执行此操作。

我尝试使用 jmx,但我不断收到异常,提示“org.jboss.util.NestedRuntimeException:jmx 未绑定(bind);”我更愿意以一种不必停止和启动应用程序服务器的方式来执行此操作。

最佳答案

您可以通过 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 的实际应用

运行 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

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

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

运行 undeploy 命令来取消部署应用程序。在本例中,test.ear。

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

部署文件夹

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

关于jboss - 从命令行取消部署 JBoss 应用程序服务器中的应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8439609/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com