Deploy to WildFly using jboss-cli (Tech Tip #11)

WildFly provides multiple ways to deploy to your applications.

So far we’ve seen:

This tip will cover the most likely way to deploy deploy applications to WildFly, i.e. jboss-cli.

jboss-cli is Command Line Interface management tool for a standalone server or a managed domain. It is available in the “bin” directory of unzipped WildFly distribution and allows a user to connect to a standalone server or domain controller and execute management operations.

“jboss-cli” can be used to deploy applications using the interactive console or in a non-interactive manner.

Lets look at interactive first:

    • Use jboss-cli to connect with the existing standalone instance by giving the following command: -c

      The -c switch connects using the default host (‘localhost’) and management port (‘9990’). These values are specified in ‘bin/jboss-cli.xml’ and can be updated.

      This opens up the “jboss-cli” interactive console and shows the following prompt:

      [standalone@localhost:9990 /]

      The prompt indicates that ‘jboss-cli’ is connected to a standalone instance’s management port.

    • Deploy the application by giving the following command in console:
      deploy target/javaee7-1.0-SNAPSHOT.war

      The directory name of the war file in the command may be different depending upon how ‘jboss-cli’ was invoked. Verify the server log to ensure that the application was redeployed. Look for specific timestamp in the log entries.

      --force switch can be included in the command to replace the existing application.

    • Verify the deployment status by typing the following command deployment-info in the console:

      and see the output as:

      NAME                     RUNTIME-NAME             PERSISTENT ENABLED STATUS
      javaee7-1.0-SNAPSHOT.war javaee7-1.0-SNAPSHOT.war true       true    OK

      Verify the server log to ensure that the application was deployed. Look for specific timestamp in the log entries.

    • Undeploy the application by giving the following command:
      undeploy javaee7-1.0-SNAPSHOT.war
    • Type “exit” or “quit” to exit the interactive console.

Now lets look at how these commands can be issued non-interactively very easily.

  • Deploy the application as: --connect --command="deploy target/javaee7-1.0-SNAPSHOT.war --force"
  • Verify the deployment status as:
    ./bin/ --connect --command=deployment-info
  • Undeploy the application as:
    ./bin/ --connect --command="undeploy javaee7-1.0-SNAPSHOT.war"
Be Sociable, Share!
  • Tweet
This entry was posted in techtip, wildfly and tagged . Bookmark the permalink.

4 Responses to Deploy to WildFly using jboss-cli (Tech Tip #11)

  1. Igor says:

    How to deploy app with context root “/” ?

  2. arungupta says: should help.

  3. tarlok says:

    Hi Arun,

    Could you please guide me How i take the backup copy on running application on Domian mode into JBOSS EAP 6 before new deployment.

  4. arungupta says:


    Backup copy of data, configuration, or archive itself ?

Leave a Reply

Your email address will not be published. Required fields are marked *

× six = 48

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>