You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mikolaj Rydzewski <mi...@becomo.com> on 2006/02/24 12:20:05 UTC

Multiple webapps using one war file

Hello,

I've got rather complex web application (struts, hibernate, etc) which 
runs on Tomcat. There is a need to deploy this webapp for various 
customers. The only difference between them is the database they connect 
to, well, almost the only one ;-)

Is there any way to reuse one war file and map it to several contexts? I 
could give application's parameters (like jndi connection uri ) within 
context.xml descriptor. Every deploy takes several MB of memory, and 
it's a waste to have hibernate and required jars five times in memory.

-- 
Mikolaj Rydzewski  <mi...@becomo.com>
Becomo S.A.
tel. (12) 2927104



Re: Multiple webapps using one war file

Posted by David Delbecq <de...@oma.be>.
While it is possible to put some of the librarie out of .war, inside
common, you must be aware of side effects. Libraries like struts are not
designed to run  multiple context within a given classloader (The
servelt, for example, can only be instanciated once). I don't know for
Hibernate and for etc :)

Also, you could take a look at .ear if you need to play with a common
part and multiple .war. But tomcat does not deploy .ear, you must use a
full featured J2EE container for this.
Mikolaj Rydzewski a écrit :

> Hello,
>
> I've got rather complex web application (struts, hibernate, etc) which
> runs on Tomcat. There is a need to deploy this webapp for various
> customers. The only difference between them is the database they
> connect to, well, almost the only one ;-)
>
> Is there any way to reuse one war file and map it to several contexts?
> I could give application's parameters (like jndi connection uri )
> within context.xml descriptor. Every deploy takes several MB of
> memory, and it's a waste to have hibernate and required jars five
> times in memory.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple webapps using one war file

Posted by Danny Lee <ha...@yahoo.de>.
I have the same situation as you,

right now working on admin interface, which actually does a lot of same 
stuff as a web app (most of the Hibernate stuff / persistance manager 
classes/ lot of business logic).

But after lot of thinking, I supose it's not a good idea to share the 
stuff, becouse:

1) It's quite hard to implement clean.
2) You can't separate the logic later.

If it's really so, that you only have different DB's, just use only one 
App and some sort of parameter, to choose the right DB in each case. It
have to be quite easy with Hibernate.

Cheers,
Danny


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org