File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Best packaging and deployment strategy for web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Best packaging and deployment strategy for web applications" Watch "Best packaging and deployment strategy for web applications" New topic
Author

Best packaging and deployment strategy for web applications

Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 75
Hi,

In our current project under development, we have multiple J2EE web applications.

The j2EE server chosen in JBoss 5.x GA

I have question regarding the best packaging structure:

The current practice is
All common functions are packaged into a commons.jar
All web applications are packaged into individual .WAR files and those into individual ,EAR files

The same is then deployed by

Copying the commons.jar into <<jboss-5.1.0.GA>>\server\default\lib
and the multiple EARs (each containing a single WAR) in <<jboss-5.1.0.GA>>\server\default\deploy

JBoss picks up the EAR and explodes it in the default\tmp folder and everything works.

However, this requires JBoss to be restarted only whenever "commons.jar" is updated.
JBoss detects any change in EAR copied into 'deploy' folder deploys automatically, no restart is required.

But, my question is it nessacary to have multiple EAR?

What could be the benefit?

I feel there should be a single EAR fils having everything commons.jar + the multiple WARs
The single EAR when copied into "<<jboss-5.1.0.GA>>\server\default\deploy" should deploy and all web applications work seamlessly.

The only reasoning I could get was the multiple WARs are under development by different teams which have different release dates.
By keeping all WAR's in a single EAR, every time a WAR is to be released, the entire EAR will have to be packaged and deployed.

This could have adverse effect on the other WARs
Another reason was to avoid packaging of the entire EAR (into which could go in a unintended version of a WAR) and deploying it,

And so multiple EARs are being maintained.

Any comments?

thank you.
g1

PS: Tech stack: j2EE, Struts, Spring, Hibernate and Oracle,
We are using a single JBoss server and not a cluster.
We are employing Ant and plain eclipse, no Jboss eclipse tools in development
uttam kumar
Ranch Hand

Joined: Jan 27, 2009
Posts: 128

My understanding is, an EAR is used for packaging one or more modules into a single archive so that the deployment of the various modules onto an application server happens simultaneously and coherently. You can embed different artifacts within an EAR file for deployment by application servers:
1) A Web module that has a .war extension.
2) POJO Java classes may be deployed in .jar files.
3) An EJB module that has a .jar extension.
4) A Resource Adapter module that has a .rar extension.

Although it will not cause any issue but there is no logic putting a single war inside an ear. Either you make an ear including all of your war or deploy each war independently without putting them into an ear.

By the way, this question has nothing do to with JBoss. Its your own decision how you want to package and deploy your web application into any of the application server.


Thanks,
Uttam Kumar
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 75
Thank you Uttam,

Yes, I feel the same way.... a single EAR should suffice, with all the WAR's, JARs, ejb-jars in it.

But I am not able to push this forward as I am unable to get an effective answer to bypass their concern:

The only reasoning I could get was the multiple WARs are under development by different teams which have different release dates.
By keeping all WAR's in a single EAR, every time a WAR is to be released, the entire EAR will have to be packaged and deployed.

Which may have adverse effect on the other already working web applications (like down time for all would be required)

Another reason was to avoid packaging into a single EAR, was an unintended version of a WAR may get packaged and deployed.

And so multiple EARs are being maintained.


thank you
~g1

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9317
    
109

All web applications are packaged into individual .WAR files and those into individual ,EAR files


Why do you need an additional .ear packaging over a .war if the .ear just contains that single .war? You can just deploy those individual .war files.

However, this requires JBoss to be restarted only whenever "commons.jar" is updated.


That's a classic classloader issue and one of the reasons why placing the application jars in JBOSS_HOME/server/<servername>/lib isn't recommended. More details here:

http://community.jboss.org/wiki/jbossclassloadingusecases
http://community.jboss.org/wiki/classloadingconfiguration


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best packaging and deployment strategy for web applications
 
Similar Threads
Purpose of different "lib" in JBoss 5
Java script is not populated on webpage.
Failure in running ear with EJB and Spring on clustered JBoss-5.1.0.GA AS
Problem deploying two war files to one instance of jboss-5.1.0.GA
How to deploy GWT web application in JBoss?