This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Multiple contexts pointing to the same application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Multiple contexts pointing to the same application" Watch "Multiple contexts pointing to the same application" New topic
Author

Multiple contexts pointing to the same application

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Does anyone know if this is in the specs?

What I want to do is, be able to have one application/war file, but have multiple web application contexts.
This will allow me to have one code base, but setup different DataSources, so each context will be connecting to a different database or a different schema.

I came accross this thread on Sun Java forums -

Java Forums - Multiple Contexts, Single Project/App

Apparantly, it is possible to do this in Tomcat. But what about other application servers, and does this violate the J2EE specs in any way?


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
Should be fine, just make sure the WAR and context paths are different - the server should then see them as 2 completely separate apps - thus no breaking of the J2EE spec


Drinking more tea is the key...
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

It should work fine.


Groovy
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Thanks guys.
 
 
subject: Multiple contexts pointing to the same application