Versioning applications with WildFly and JBoss EAP

This short tutorial will show you how to emulate an application versioning on JBoss EAP / WildFly with some simple management steps.

One common task for most system administrator is the need to switch to an older/newer version of an application. If you deploy one application using automatic deployment, or simply replacing the application you will get that the newer application merely replaces the older one. That's not a big issue if you have a solid provisioning system, however it's good to know that the application server has been trained to do this for you!

Let's see a basic example. You have an application packaged as demowebapp-1.0.war with the following jboss-web.xml file that defines the context root:

<jboss-web>
  <context-root>/demowebapp</context-root>
</jboss-web>

Now we will deploy the application using WildFly Web Console so reach localhost:9990 and click on Deployments

jboss wildfly versioning tutorial

Pickup the application to be deployed as shown by the following picture and flag it as enabled:

jboss wildfly versioning tutorial

Now the twist: The Application Name is an unique identifier of the deployment. However the Runtime Name is the name by which the deployment should be known within a server's runtime. This would typically be the same as 'name', but in some cases users may wish to have two deployments with the same 'runtime-name' both available in the deployment content repository, in which case the deployments would need to have distinct 'name' values but would have the same 'runtime-name'.

As you can see, we have used demowebapp.war as runtime name. Now let's deploy another version of the application, say demowebapp-2.0.war:

jboss wildfly versioning tutorial

As you can see, the runtime name is the same and the application is disabled otherwise there will be two applications with the same runtime name at the same time.

Test it!

The first test will be verifying that we are delivering the version 1.0 of the application:

http://localhost:8080/demowebapp

jboss wildfly versioning tutorial

Now let's disable the application demowebapp-1.0.war and conversely enable the application demowebapp-2.0.war

jboss wildfly versioning tutorial

jboss wildfly versioning tutorial

And now let's test again the application:

jboss wildfly versioning tutorial

Good, we can safely swap between application versions- the only trick is to keep just one enabled!

Related articles available on mastertheboss.com

How to configure JBoss to disable hot deployment ?

On JBoss AS 7 and WildFly the default rule is that archived appli

How do I make sure my MBean is deployed after my EJB ?

  If your MBean is dependant on another resource, supposing cont

How do I change the default lib directory in an ear file?

  Supposing you have an Enterprise application which has been pa

How to let JBoss deploy an application after other apps?

  If you are running JBoss AS 7 or WildFly check the following t

How to deploy an application temporarly with JBoss ?

One way to do it, is using the jboss.system:service=MainDeployer

How to add a custom JBoss archive in an Ear ?

JBoss custom archives (like .sar or .har) are not recognized by t

Follow us on Twitter