Can I get the JBoss CLI tool to report an exception that caused my deployment to fail?

Im using JBoss 7.1.3.Final. When deploying using the CLI tool, can you also throw an exception that occurred in the logs that caused the deployment to fail? We are launching automatic night deployment, and Id is able to report the exception in an email, rather than forcing people to log in and view server logs. Here is what I am doing so far ...

$ $JBOSS_HOME/bin/jboss-cli.sh --file=/tmp/my.cli

in which the contents of "my.cli"

connect
deploy --force /tmp/my.war

However, what is now being reported on the Commond line,

{"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./my" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./my: JBAS018040: Failed to start context"},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"my.war\".jboss.security.jacc Missing[JBAS014861: <one or more transitive dependencies>]"]}}}
+4
source share
2 answers

Jboss ( ), , jboss-cli. !

, jboss linux:

, ( -). :

deploy_response = $( $JBOSS_HOME/bin/jboss-cli.sh --file=/tmp/my.cli )

, , ( , ) .

## readling last 3 lines and joining them into one line
deploy_response = $( tail -n3 /your/log/file.log | tr "\\n" " ")

. . Jboss JBASxxxxxx. jboss.

## if [[ $deploy_response == *Composite operation failed* ]]
if [[ $deploy_response =~ JBAS\d\d\d\d\d\d ]]
then
   ## assuming you have send mail is configured.
   echo $deploy_response | mail -s "jboss deployment error" admins@localdomain.com
fi
0
0

Source: https://habr.com/ru/post/1528199/


All Articles