Quantcast
Channel: Save Your Knowledge
Viewing all articles
Browse latest Browse all 9

Hot Deploy on JBoss (5.0.1) (JSF, SEAM)

$
0
0

In this period,i’m working on a J2EE project based on EJB3 and JSF with RichFaces.
The building and deploying are managed with ANT scripts.
Every time i need to modify just a little label on a .properties file or other view element, i have to launch the ANT redeploying script, and this operation take 2 minutes

After a tons of borer redeploying i decided to use the HOT DEPLOY, an easy way to make incremental deploy of web application, provided by the most important Application Server. JBoss 5.0.1 in my case.

My IDE is Eclipse Helios. I downloaded JBoss Tools that adds some connector for JBoss Application Server.

JBoss Tools can be downloaded from the project home page http://www.jboss.org/tools, choosing the right version for your Eclipse version.

One downloaded the tools, in the Eclipse menu Window -> Show View -> Server and then Right click on the view just opened and select NEW.

Will be appear a windows for Server selection, select JBoss Community folder and then click on the right version.

Add a new Jboss AS Connector

Following the wizard we create the configuration.

Right-click on the just created connector will open the settings window.

JBoss Settings

I don’t want to explain how to set your JBoss server, but i want focus on two points:

-On Publishing section,make sure that the option Automatically publish when resources change is selected. In this way every time you change a project resource, it will be automatically deployed

-On Deployment tab, make sure that the option Use the JBoss deploy folder is selected. In this way we will be sure that all deploying will be made on deploy folder of your JBoss configuration.

To add your project to JBoss, right-click on server instance and select Add and Remove

Add a project

On the left are listed all deployable projects, and on the right all deployed projects. Just move on the right the projects that you want to be deployed on the server and click on Finish.

Now under JBoss instance, you can see all projects you selected, labeled with a state that inform you if the resource is synchronized on JBoss deloy folder.

There is a mbean in JBoss that scan deploy folder looking for any change. The default scan period is set in 5000 ms. If you want to change this value you have to change scanPeriod property in hdscanner-jboss-beans.xml in deploy folder.

Remember that not all resources are Hot Deployable. For example if you change EJB methods signatures or a configuration file (like web.xml), JBoss will redeploy the connected application.

A last point for JSF or Seam hot deploy. If you change a .jsp or .xhtml (or other view resource), Eclipse will change this resources also on deploy folder but you won’t see the change. This happens because JSF creates facets from these files. You have to set facest.REFRESH_PERIOD in web.xml file with a value that says to JSF for how long it have to wait to refresh the facets. If this value is -1, the JSF core will never refresh the view if you don’t redeploy the application. In development environment 1 or 2 seconds is good. In Production environment it will be better to set -1.



Viewing all articles
Browse latest Browse all 9

Trending Articles