Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 23 Next »

As of CARGO 1.0.3, the way CARGO supports remote deployments on the JBoss Application Server has drastically evolved. This document explains how to configure this support.

JBoss 4.0.x and 4.2.x

In JBoss 4.x, the JMX-based remote deployer can accept URLs that point to another machine. For example:

In this case, our JBoss server on will connect to via HTTP and download the paruemas-1.0-SNAPSHOT.war file. Once the file is downloaded, JBoss will automatically deploy it.

The CARGO JBoss container uses this principle to expose your Java EE application to JBoss using an HTTP server that is started on the machine where CARGO is currently running. That HTTP server is controlled using two parameters:

  • JBossPropertySet.REMOTEDEPLOY_HOSTNAME (i.e., cargo.jboss.remotedeploy.hostname): sets the hostname that the JBoss server will attempt to connect to. By default, the CARGO JBoss container will automatically resolve the current machine's network name or IP address and fill this accordingly.
  • JBossPropertySet.REMOTEDEPLOY_PORT (i.e., cargo.jboss.remotedeploy.port): sets the port number on which the HTTP server will be started on the machine running CARGO. By default, that one is set to 1 + the HTTP port for JBoss. For example, if JBoss is running on HTTP port 8080, then the default for JBossPropertySet.REMOTEDEPLOY_PORT will be 18080.

The obvious limitation you should be aware of is that JBoss needs to have direct access to the machine running CARGO.

JBoss 5.0.x, 5.1.x, 6.0.x and onwards

Starting from JBoss 5.x, JBoss has a Deployment Manager that can be used for deploying things on the JBoss server. If you really want to know how it works under the hood, you can read about this feature on the JBoss Website. If you only want to remotely deploy applications using CARGO to your JBoss server, you can of course ignore that document.

To connect to the JBoss Deployment Manager, CARGO uses JBoss' JMX RMI port; and that's what makes things get a bit complicated. For the connection to succeed, the following JARs need to be in the container classpath or in the current Java Thread's context classloader:

  • The CARGO JBoss remote deployer for your version of JBoss
  • JBoss deployment manager JARs
  • JBoss remoting client JARs

Here is an example code for the users of the Java API:

Here is an example Maven2 plugin configuration:

Starting from CARGO 1.1.0, it is also possible to remotely deploy to JBoss farms versions 5.x and newer. To do so, use these two properties:

  • cargo.jboss.clustered: if true, deployment is done in the farm directory
  • cargo.jboss.configuration: JBoss profile name, default name is default

JBoss Maven2 repositories


JBoss has decided to deprecate one of the repositories used in some releases of the Cargo JBoss remote deployer POMs. The trouble is that JBoss has decided to return an error 403 Forbidden, instead of an error 404 Not Found, for that repository; making Maven fail with messages like:

In this case, please define override the JBoss repo by using a mirrorOf declaration in your settings.xml. Example:

Please feel free to complain to JBoss if you feel like this is a bad behaviour:

JBoss socket connection bugs


On some Linux distributions, remote deployment may fail with an exception like:

That is a known bug, documented in and the solution presented on that document is to use a cron job as the root user to fix the file when it gets broken.

First, create the correct version of /etc/hosts and save it somewhere, such as /etc/hosts.fixed, and populate it with the following contents (replace myhost with the hostname of your computer, as reported by the hostname command, and the correct IP assignment, as reported by ipconfig):


Important: If possible, enter your hostname with both the "basic" hostname and the fully-qualified domain name.

Next, create a script named /etc/ to replace the /etc/hosts file if Network Manager breaks it:


Finally, setup a cron job to run this script as often as you like. We recommend every couple of minutes.

Once the /etc/hosts file is corrected, restart JBoss AS and run the tests again. Your socket connection error should be gone!

  • No labels