• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Clean Programmer

Clean Programmer

Programming & DevOps Resources

  • Home
  • About
  • Contact

Deploy applications to a remote WildFly server using jboss-cli

July 18, 2018 Monzurul Haque Shimul

WildFly is a free, open source & cross platform application server (formely known as Jboss AS or Jboss). It is written in java programming language & currently it is being maintained, developed by Redhat. It is one of the most popular application servers among Java EE programmers all around the world.

WildFly provides multiple ways to deploy your applications. In this post, we will deploy applications to remote WildFly using jboss-cli. See my other posts to learn the other ways to do it.

  • Deploy applications to a remote WildFly Server using jboss-cli-client.jar
  • Deploy applications to a remote WildFly server using curl
  • Deploy applications to WildFly server using wildfly maven plugin

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.

For deploying applications to remote WildFly server, you need to have WildFly distribution in the client machine. Download the latest stable version from WildFly official download page and extract in a directory of your preference.

Now go to the bin directory of unzipped WildFly distribution. To install applications in remote WildFly, run:

./jboss-cli.sh --connect --controller=<REMOTE_WILDFLY_IP>:9990 --user=<USERNAME> --password=<PASSWORD> --command="deploy /PATH/TO/test.war"

Here, --controller parameter does the trick. It is used to connect to remote WildFly server and run command on that. --user and --password parameters takes the management username, password of the remote WildFly for authentication purpose. command parameter takes the command to run; here, our command is to deploy a test.war file. You can send any jboss-cli supported command to remote WildFly using this method.

If the application is already deployed, you will get a failure response:

org.jboss.as.cli.CommandFormatException: 'test.war' already exists in the deployment repository (use --force to replace the existing content in the repository).

In that case, you need to add --force in the command to replace the existing content in the wildfly repository

./jboss-cli.sh --connect --controller=<REMOTE_WILDFLY_IP>:9990 --user=<USERNAME> --password=<PASSWORD> --command="deploy /PATH/TO/test.war --force"

Or you can undeploy the application before new deployment:

./jboss-cli.sh --connect --controller=<REMOTE_WILDFLY_IP>:9990 --user=<USERNAME> --password=<PASSWORD> --command="undeploy test.war"

To know the deployment status, run:

./bin/jboss-cli.sh --connect --controller=<remote_wildfly_ip>:9990 --user=<username> --password=<password> --connect --command="deployment-info"

And the output should be:

NAME     RUNTIME-NAME PERSISTENT ENABLED STATUS 
test.war test.war     true       true    OK

That’s it! Now your application is deployed and enabled in the remote WildFly server instance using jboss-cli.

Related Posts

Mapping Between Domain & Data Transfer Objects With MapStruct
Mapping Between Domain & Data Transfer Objects With MapStruct
Adding 3rd Party Jar to a Maven Project
Practicing Java: Simple String Encoding and Decoding
Practicing Java: Simple String Encoding and Decoding

Categories: Java EE, Wildfly Tags: java, java-ee, jboss, jboss-cli, wildfly

Primary Sidebar

Categories

  • Apache Kafka
  • Druid
  • Git
  • Java
  • Java EE
  • Redis
  • Spring
  • Uncategorized
  • Weblogic
  • Wildfly

Featured Posts

Generating Prime Number Sequence Using Java Stream API

How to install WildFly application server version 13.0.0.Final

Most frequently used commands for managing Kafka Topic

How to configure JMS in WildFly

Configure Druid to Use Lookups from CSV Files

Calculate Character Frequency In String Using Java Stream API

Footer

Monzurul Haque Shimul

I’m a full-stack software engineer with 10 years of experience in design and development of large scaled Enterprise Software Systems built on Java and Java EE related tools and technologies. I’m also a contributor on GitHub, Stack Overflow, DZone. My core expertise lies in building JVM-based, scalable, reactive, data-driven applications.

Follow

  • Email
  • GitHub
  • LinkedIn
  • Twitter

© 2019 CLEAN PROGRAMMER

  • Home
  • Archive
  • About
  • Contact
  • Privacy Policy
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OKNoRead more
Revoke Cookies