File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Multiple war files for a single webapp or context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Multiple war files for a single webapp or context" Watch "Multiple war files for a single webapp or context" New topic
Author

Multiple war files for a single webapp or context

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

I have an application that has the following structure



The application is delivered as a war file (i.e. myapp.war) and is deployed into the $TOMCAT_HOME/webapps folder. If any of the files change (either the jsp, css, js or java files) i have to always rebuild the whole war file. This means i deploy every single file on every release.

I am wondering if there is a way to deploy specific areas of the application. I am particularly interested if it is possible to separate the application into multiple war files. i.e. myapp.war, articles.war and forum.war. I would like to still access the application via the same context i.e. http://0.0.0.0/myapp even though multiple war files are used.

Using this approach, i will be able to deliver just the module that was affected by the change. Is this at all possible?

I dont mind having to restart the container after each war file is deployed.

I know that i can deploy the application as individual folder but would prefer to archive each individual module. If it is not possible with War files, is there any other archiving mechanism that would allow me to do the above.

Thanks in advance
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

Why? I mean, what problem are you trying to solve with that problem?
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Paul Clapham wrote:Why? I mean, what problem are you trying to solve with that problem?


Hi Paul

Thanks for your response. We using ANT to build the war file so building it is not the biggest problem i am experiencing. The problem i am having is that there are two teams working on the application. This means that if one team is working in one area of the application and it takes a week to complete the testing, the other team will have to wait for the other to finish before they can release a change related to a different area of the application.

Even though the application source code is managed within CVS, we are still finding it difficult because there is no easy way out. As an example, if Team A is working on a change on the Articles section, Team B who is working on the "Forums" section will have to wait for Team A to make their release before they can make their release.

We did consider branching but found that branching adds a lot of complexity and that it also doesnt always work and we end up in the same situation especially if there is a dependency in the modules. I thought that if i could separate the war files, the different teams would in effect be working on different applications.

Thanks in advance



Pankaj Kr. Singh
Ranch Hand

Joined: Mar 31, 2011
Posts: 32

Hi Ziggy,

you just create separate jar files of each module and it is not a big thing in ant.
And then combine each of the Jar file to create a WAR that you like to create and deploy it.

And this will work your problem that Team A is working on forum and B is working on Article this will be very easy to manage.

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Pankaj Singh Hari Om wrote:Hi Ziggy,

you just create separate jar files of each module and it is not a big thing in ant.
And then combine each of the Jar file to create a WAR that you like to create and deploy it.

And this will work your problem that Team A is working on forum and B is working on Article this will be very easy to manage.



Hi, Do you mean create a jar file for each module (articles.jar, forum.jar, guestbook.jar) and build the war file on every deployment? I guess this could work if i could keep the previous jar files from previous release on a specific build area. When a module is release (e.g. articles.jar) i could build the war file using the new articles.jar using forum.jar and guestbook.jar from the prevous release.
Pankaj Kr. Singh
Ranch Hand

Joined: Mar 31, 2011
Posts: 32

Hi
There is no need to create war again and again when you change the one module like forum then ony replace the forum.jar to the specified deployment area and restart the server it will work out your problem.
O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Pankaj Singh Hari Om wrote:Hi
There is no need to create war again and again when you change the one module like forum then ony replace the forum.jar to the specified deployment area and restart the server it will work out your problem.


But wouldnt the jar file need to be expanded? i.e Tomcat cant read jsp, css files inside a jar file or can it?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

So you don't have a problem with Tomcat at all. You have a management problem, not a technical problem. So in my opinion you should be looking for management solutions, not technical solutions.

We have an "Agile and Other Processes" forum; I wouldn't classify your development methodology as "agile" and I don't suppose you would either, but it might be worth posting your management problem in that forum anyway. You might also want to clarify your problem as well, because I can't tell whether you feel you aren't getting updates out fast enough, or frequently enough, or what.

(I agree with you about branches in CVS: I tried them and they work fine, but reconciling a branch with the main trunk was tedious and error-prone. But I suspect branches shouldn't be allowed to live for too long. The longer they live, the harder it is to reintegrate them. That was my problem and it sounds like it might be yours, too.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple war files for a single webapp or context