I have a war file and I need to deploy it on Jboss 7.0.1 Server. Now I have gone through the documentation, but didnt find any thing to deploy a war file. Moreover for deploying your build through command line you generally have to use maven. So do we need for the war as well? If so, does it affects the war file?
FYI : I am using linux (CentOs5)...
jboss
is already running. Commandps -ef | grep jboss
JBSS_HOME/bin/
and open JBOSS CLI. Command to open CLI is./jboss-cli.sh
.[disconnected /]
. Now, run the commandconnect
. It will show like this[standalone@localhost:9999 /]
"deploy /YOUR_WAR_PATH.war"
. Example:"deploy /tmp/my_app.war"
That's all we need to do.
Happy Learning..
You can deploy a .war file using the Management Command Line Interface. The specific documentation for it is located here: JBoss AS7 Admin Guide - Deployment, with the relevant sections per the below. You might also like to have a quick watch of the video: 5 Ways To Deploy Your Applications To JBoss AS7
CLI Deployment To A Managed Domain
The process of distributing deployment binaries involves two steps: You need to upload the deployment to the repository from which the domain controller can distribute it's contents. In a second step you need to assign the deployment to one or more server groups:
Using the CLI you can do it one sweep:
After you've uploaded the binary using the "deploy" command, it will be available to the domain controller and assigned to a server group:
In a similar way it can be removed from the server group:
CLI Deployment To A Standalone Server
Deployment on a standalone server works similar to the managed domain, just that the server-group associations don't exist. You can rely on the same CLI command as for a managed domain to deploy an application:
CLI Deployment to Standalone Server (one liner Shell command)
You can deploy a WAR in one shot from the Shell as well. This is useful for Bash scripts or Unix aliases. NOTE: This exposes the password, so only use it for personal development instances. Ensure $JBOSS_HOME is set, and change Password and WAR file path & name below as needed:
Footnote: As you would know, you've got the Management Console for deployment, as well as the deployment scanner. The former is popular as any GUI would be, but the latter is more for development. I try to use the CLI as much as possible, as the learning curve is well worth the effort for the power of batch scripting and the sheer scale of low level operations that are exposed by the CLI API. Very cool stuff. I should add for sake of transparency that I work on the AS/EAP documentation team, so I might be biased.