Tuesday, December 04, 2012

J2EE Web Application Deployment setup for Development in JBoss AS 7.1

Deploying a J2EE web application is very easy in JBoss AS 7.1.x server. Make your J2EE application as a war file, login to JBoss admin console, in Manage Deployments area, you can upload the war file and Enable it to make it deployed. But, is it possible to keep the deployment process like this while you are developing an application? Certainly not. This process will consume lot of time to see the development changes working.

This post will help you to setup the deployment process for development in JBoss.

Instead of deploying the application as a war file, we are going to deploy it as a exploded war directory under <JBoss Home>/standalone/deployments/. This is called exploded deployment, which helps development in greater extent. Follow the steps to get the exploded deployment working,


  • Create a directory with .war suffixed with your application name under   <JBoss Home>/standalone/deployments/ directory.
  • In <JBoss Home>/standalone/configuration/standalone.xml, add auto-deploy-exploded="true"  attribute to deployment-scanner node under deployment-scanner subsystem. 
  • You can also set scan-interval (scan-interval="5000") attribute and set your an interval to the  deployment-scanner node. For example,
            <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" auto-deploy-exploded="true" deployment-timeout="1200"/>
  • If the above are done, you have to get the J2EE application contents placed in the deployment directory we have created. It is better to link the output folders to the deployment directory, if you are using an Eclipse based IDE. JBoss will redeploy the application when it finds a change in the code. So all you have to do while development is, do a build when you want to see the code changes working.


When I was running the application successfully, I noticed that all the cookies from the application is suffixed with . undefined . For example, 

Ur1bLe3UDdWJ9xm0ZDbMfZvJ.undefined

this is a bug in JBoss 7.1x and as a workaround, you have to set instance-id attribute in jboss:domain:web subsystem in standalone.xml. For example,

<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false" instance-id="myDomain">

This is not a serious issue, but include the above configuration changes as a good practice. 



No comments:

Post a Comment