• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Deploying multiple applications from the same WAR

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to solve a maintenance nightmare. I've got 25 versions of the same application, e.g. http://www.domain.com/app1, http://www.domain.com/app2, http://www.domain.com/app3, etc. Now every time we upgrade our system we have to update 25 separate applications. What I would like to be able to do is run all of the applications off the same WAR but with individual connections to their own DBs and private space for custom configuration files.

This would save tremendously on the amount of memory used, and give a single point of upgrade for all the applications. Boy howdy, but that would be nice!

Is this possible? Any suggestions, pointers, tips, how-to's available on this?

thanks.
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you create WAR files? Is it automated process?

For deployment automation check 'Executing Manager Commands With Ant' - http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant
 
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's not a problem if you design your WAR to be externally configured. You simply create multiple Context files, each with the same codeBase, but different database and other per-instance characteristics.

However, I'm not too sure you'll save as much memory as you hope. Tomcat creates a different classpath for each running webapp. I don't know if that means that their respective classloaders can share the read-only parts, but for certain the class variables won't be shared.
 
Damon Anderson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually saving memory is secondary to reducing implementation difficulties... do you think you could detail a little more specifically how it would work with context files?

 
Tim Holloway
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Each context goes into a separate file under TOMCAT_HOME/conf/Catalina/localhost. Name isn't critical - app1.xml and app2.xml works just fine. I have a common codebase (exploded WAR in this example), but each app has its own database. If I had config files, I could define their paths as context resources as well.
 
Our first order of business must be this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic