January 2, 2013

How to deploy and undeploy in JBoss EAP 6

Introduction

In this blog I will present how to deploy application with JBoss EAP 6 and JBoss AS 7, both via the new Command Line Interface, CLI and the traditional way, by dropping deployable in deployment folder.

Old School - Deployment Folder

The easiest way is to start the JBoss in standalone and drop the deployable package in $JBOSS_HOME/standalone/deployments/ folder. If successfully deployed you will a get a new marker file in the deployment folder with extension .deployed.

To undeploy simply remove the deployable file.

And to redeploy simply touch a file with the same name as deployable + ".dodeploy".

New Way - Command Line Interface, CLI

The new and recommended way to manage deployments are via the CLI tool. Before you can proceed with the CLI you must first start your JBoss. Then you start the CLI with $JBOSS_HOME/bin/jboss-cli.sh.

To connect to local server simply type connect. And if you want to start a remote server, the easiest way is to open a SSH tunnel to the remote server and do the above.

$ connect

To deploy, use the deploy command. Remember that JBoss CLI has autocompletion, which means you can use the tab key for autocompletion of paths and commands.

deploy /tmp/demo-1.0-SNAPSHOT.war

To verify the deployment, you can either do that with the JBoss CLI tool.

$ cd deployment=
$ ls -l
demo-1.0-SNAPSHOT.war

Or open the standalone.xml file.

    <deployments>
        <deployment name="demo-1.0-SNAPSHOT.war" runtime-name="demo-1.0-SNAPSHOT.war">
            <content sha1="303fe111257bf4f083d3f0e3f403b4f5e7e1de0c"/>
        </deployment>
    </deployments>

And to undeploy.

undeploy demo-1.0-SNAPSHOT.war

No comments: