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:
      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:

      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:

      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:

      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:

    • 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:
  • Verify the deployment status as:
  • Undeploy the application as:
Be Sociable, Share!

6 thoughts on “Deploy to WildFly using jboss-cli (Tech Tip #11)

  1. 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.

  2. Is there any way to change the management port number from 9990 to different port number using CLI in wildfly8 ?

  3. Is jboss-cli able to backup the deprecated WAR during a deployment replacement for an eventual rollback?

Leave a Reply

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