Deploying applications on a JBoss AS domain

It is not possible to deploy apps in a JBoss domain using the same cut-and-paste method as in a standalone domain In the domain model, several servers belonging to various server groups, each running a distinct profile, may be found. We have explained in this blog how to deploy applications on a JBoss as a domain.

Deploying applications in a JBoss domain cannot be achieved with a single cut-and-paste operation like for standalone domains. As a matter of fact, there’s no predefined deployments folder in the domain installation. The reason for this is because in the domain mode, there can be many servers belonging to different server groups, each one running different profiles. In that situation, a single deployments folder would raise the obvious question: which server groups will be using that folder? This requires some knowledge that the AS deployment scanner cannot have.

So, basically, a deployment on a JBoss AS domain can be performed using the following set of options:

  • Using the Command Line interface

  • Using the Admin Web interface

Here’s a complete outline of both approaches:

Deploying to an AS domain using the CLI

Start by launching the CLI and connect to the domain controller:

[disconnected /] connect Connected to domain controller at localhost:9999

When you are deploying an application using domain mode, you have to specify to which server group the deployment is associated. The CLI lets you choose between two options:

1. Deploy to all server groups.
2. Deploy to a single server group.
We discuss the options in two separate sections.

Inclined to build a profession as JBOSS Developer? Then here is the blog post on JBOSS TRAINING ONLINE.

Deploy to all server groups

When choosing this option, the application will be deployed to all the available server groups. The –all-server-groups flag can be used for this purpose.

For example: [domain@localhost:9999 /]

deploy ../application.ear –all-

server-groups

Successfully deployed

application.ear

If, on the other hand, you want to un-deploy an application from all server groups belonging to a domain, you have to issue the undeploy command:

[domain@localhost:9999 /] undeploy application.ear –all-relevant-server-groups

Successfully undeployed application.ear

You might have noticed that the undeploy command uses the –all-relevant-server-groups instead of –all-server-groups. The reason for this difference is that the deployment may not be enabled on all server groups, so by using this option, you will actually un-deploy it just from all the server groups in which the deployment is enabled.

Deploy to a single server group

The other option lets you perform a selective deployment of your application, just on the server groups you have indicated.

MindMajix Youtube Channel

[domain@localhost:9999 /]

deploy application.ear –server-groups=main-server-group Successfully deployed application.ear

You are not limited to a single server group, but you can separate multiple server groups with a comma; for example:

Frequently asked Jboss Interview Questions

[domain@localhost:9999 /] deploy application.ear –server-groups=main-server-group,other-server-group Successfully deployed application.ear

Now, suppose we want to un-deploy the application from just one server group. There can be two possible outcomes. If the application is available just on that server group, you will successfully complete the un-deployment:

[domain@localhost:9999 /] undeploy

as7project.war –server-groups=main-server-group

Successfully undeployed as7project.war.

On the other hand, if your application is available on other server groups, the following error will be returned by the CLI:

 Undeployed as7project.war

It seems that something went wrong. As a matter of fact, when you are removing an application from a server group, the domain controller checks that the application is not referenced by any other server group, otherwise the previous command will fail.

You can, however, instruct the domain controller to un-deploy the application, without deleting the content also:

[domain@localhost:9999 /] undeploy

application.ear –server-groups=main-server-

group –keep-content Successfully undeployed

application.ear.

So, we have learnt quite a lot of available options to deploy applications in a domain. Before moving to the admin console, let’s review the CLI deployment options:

Command-Options-Effect

Deploying to an AS domain using the Admin console

Deploying applications using the Admin console is pretty intuitive and requires just a few simple steps. Start by logging into the Web application at the default address: https://localhost:9990/console.

Then, select the Runtime tab (Point 1 in the screenshot). You will see that in the left panel of the screen, there’s a Deployments menu, which includes the option Manage Deployments (Point 2).

Deploying to an AS domain using the Admin console

From there, you can use the tabbed menu named Server Groups (Point 3) to check which applications are deployed on the single server groups.

The application can be uploaded using the Add Content button (Point 4), which introduces you to the next dialog:

Add Content button

Once you are done with the upload wizard, the application will be uploaded to the domain repository. In order to deploy/un-deploy it to the single server groups, you should select first the server group (Option 1) on which you want to operate, and then click the Add to Group (Option 2) button.

Domain Deployments

At this point, the application is deployed but still not enabled. Choose the Enable button to complete the deployment of the application.

Manage Deployments

The Remove button within the Server-Groups area will remove the deployment from the server group selected, while the other Remove button within the Content Repository will actually delete it from the temporary domain repository where uploaded applications are bundled.

Explore Jboss Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
JBoss TrainingNov 19 to Dec 04View Details
JBoss TrainingNov 23 to Dec 08View Details
JBoss TrainingNov 26 to Dec 11View Details
JBoss TrainingNov 30 to Dec 15View Details
Last updated: 27 Sep 2024
About Author

Ravindra Savaram is a Technical Lead at Mindmajix.com. His passion lies in writing articles on the most popular IT platforms including Machine learning, DevOps, Data Science, Artificial Intelligence, RPA, Deep Learning, and so on. You can stay up to date on all these technologies by following him on LinkedIn and Twitter.

read less