问题描述
当通过jboss-cli(print()
)使用热部署时,如果部署它存在问题,则会有一些描述该问题的输出,例如(实际上打印得不太漂亮。^^):
protected
不使用热部署时,例如在deploy --file on_controller.war
中使用{
"WFLYCTL0080: Failed services" => {
"jboss.undertow.deployment.default-server.default-host./THE_WAR" =>
"< some description containing exceptions etc >"
}
}
时;
如何使用jboss-cli读取此错误?
我知道这里有<fs-archive />
命令,但这只告诉部署是否失败,却没有原因。
我也尝试过standlone.xml
,但它仅包含部署是否失败。
另外deployment-info
将返回/deployment=*:query()
,即使在引导过程中出错。
解决方法
您可以尝试/core-service=management:read-boot-errors
:
[standalone@jboss:9990 /] /core-service=management:read-boot-errors
{
"outcome" => "success","result" => []
}
由于输出可能难以解析when using automation,因此您也可以使用JBoss的HTTP Management API,它将为您提供JSON:
$ curl --digest --location --dump-header - http://$JBOSS_HOST:9990/management/ \
--header "Content-Type: application/json" --data - --user admin <<EOT
{
"address": {
"core-service": "management"
},"operation": "read-boot-errors","json.pretty": 1
}
EOT
HTTP/1.1 401 Unauthorized
Connection: keep-alive
WWW-Authenticate: Digest realm="ManagementRealm",nonce="--%<--",opaque="00000000000000000000000000000000",algorithm=MD5,qop=auth
X-Frame-Options: SAMEORIGIN
Content-Length: 77
Content-Type: text/html
Date: Thu,13 Aug 2020 10:29:33 GMT
HTTP/1.1 200 OK
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
Content-Type: application/json; charset=utf-8
Content-Length: 48
Date: Thu,13 Aug 2020 10:29:33 GMT
{
"outcome" : "success","result" : []
}
({<<EOT ... EOT
是heredoc,其余命令是from the documentation)