I have a WildFly 10 server in which about 12 deployments are installed, and the list of deployments may change periodically. The main problem is that when i'm restart the server, applications are trying to deploy simultaneously. However, most applications cannot start until some other deployments have been launched. In fact, they have a strict sequence to run. Thus, when the Wildfly server is restarted, part of the deployment will be started with an error and will not work. I came up with some hack:

  1. Stop the server process WildFly
  2. In standalone.xml, all deployments set to the disable status (via the cli command)
  3. Start the server WildFly
  4. Run the script:
    export JAVA_HOME=/usr/java/jdk1.8.0_131
    export WILDFLY_HOME=/opt/wildfly



    args="--connect --controller=`hostname`:9990"

    modules=`$jcli $args --command="ls deployment -l" | sed 's/\(.*\)/deploy --name=\1/'`

    if [ -z "${modules// /}" ]
       echo "Nothing to start on this server `hostname`"
       exit 0

    $jcli $args <<EOF
    run-batch --headers={allow-resource-service-restart=true}

At the same time, when I first run the script from 4 points, I get errors: ClassNotFoundException and NoClassDefFoundError. No deployments start. But if i'm run this script a second time - everything starts.

Actually the question is, how is it that the second time everything starts? Is there a way to make it easier, without errors, maybe there is an operation in the CLI that does all this “correctly” (generates a startup sequence or something like that)?


As it turned out, this approach works every other time.

In other words, in 50% of cases, even from the second time, all applications do not start with such a script.

I had to resort to the formation of a variable that describes the sequence of starting applications. This sequence includes all possible applications, so if some of them are pre-installed, then this is not a problem. The script checks for applications through the command:

ls deployment -l

Next, it checks the output with a list of sequences and launches in turn those applications that are available on WildFly.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.