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. The most notable features of WildFly are:
- Fast Startup,
- Small Footprint,
- Modular Design,
- Unified Configuration and Management
And of course Java EE! In this post, I will show you how to install applications in WildFly application server using
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.
jboss-cli to connect with the existing standalone instance by giving the following command:
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:
[standalone@localhost:9990 /] deploy target/test-app.war
Similarly to deploy ear file, run:
[standalone@localhost:9990 /] deploy target/test-app.ear
The directory name of the war/ear file in the command may be different depending upon how
jboss-cli was invoked. For this demonstration, create a directory named ‘target’ inside WildFly installation directory and keep your ear/war file inside that directory before running the deploy command. Verify the server log to ensure that the application was redeployed.
–force switch can be included in the command to replace the existing application.
[standalone@localhost:9990 /] deploy target/test-app.ear --force
Verify the deployment status by typing the following command deployment-info in the console:
[standalone@localhost:9990 /] deployment-info
Undeploy the application by giving the following command:
[standalone@localhost:9990 /] undeploy test-app.war
quit to exit the interactive console.
Now lets look at how these commands can be issued non-interactively very easily.
To deploy the application, run:
$ ./bin/jboss-cli.sh --connect --command="deploy target/test-app.war --force"
Verify the deployment status by running:
$ ./bin/jboss-cli.sh --connect --command=deployment-info
And to undeploy the application, run:
$ ./bin/jboss-cli.sh --connect --command="undeploy test-app.war"