You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yongqin Xu <yo...@hotmail.com> on 2011/04/22 18:59:52 UTC

shared library in tomcat container runtime`

Hello,

According to TC docs, $CATALINA_HOME/lib can hold shared lib jars for all deployed apps, and each deployed app
, such as web app, will have its own classloader. My question is:
In runtime, will each app  get its own separate object instances from the same shared lib jars? Even for those static
members of the class, right?

thanks
 		 	   		  

Re: shared library in tomcat container runtime`

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yongqin,

On 4/22/2011 1:33 PM, Yongqin Xu wrote:
> that means, for our own shared lib jars, we have to duplicate them
> for each deployed apps, even if sometimes the shared lib jars could
> be over 100MB. That would really cumbersome!

100MB of libraries is not going to over-fill your disk, not will it
overfill the disk on your revision control server.

What /will be/ cumbersome is trying to remember which libraries you need
to install into your application server's shared library directory
before you can get your webapp to successfully run.

Sun went through great pains to make sure that webapps could be
self-contained, all wrapped safe and warm in their WAR files which
contained everything they needed other than container-guaranteed
services. Why not follow the standard and package your dependent
libraries with your webapp?

> Does TC has other way around to fix this? WLS does not work that
> way.

You can use a "shared" class loader if you want to. Read
catalina.properties to see how you can do that. I wouldn't recomment
using it, though: you really limit the flexibility of your webapps when
you start doing things like this.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2xxmMACgkQ9CaO5/Lv0PBkAQCgmWS5eXOLX03b+7D8JPwoJF51
fRoAmwXeu21xt8GPgQKmsA+yC+VPP9rd
=tNYm
-----END PGP SIGNATURE-----

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


RE: shared library in tomcat container runtime`

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> Subject: RE: shared library in tomcat container runtime`

> look like TC7 does not give user a choice to deploy their app as a 
> shared library or a normal app, but a normal app, right?

There's no such thing as a shared library in the servlet spec.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


RE: shared library in tomcat container runtime`

Posted by Yongqin Xu <yo...@hotmail.com>.
Currently we are trying to create community edition for our framework to run at TC 7, what we truly need is: user can deploy a app as a shared library in runtime, 
and other deployed apps can access it and get its own stack and would not interfere each other. This is basic features found in WLS and WAS,

>From all inputs so far I get, look like TC7 does not give user a choice to deploy their app as a shared library or a normal app, but
a normal app, right?

> From: Chuck.Caldarale@unisys.com
> To: users@tomcat.apache.org
> Date: Fri, 22 Apr 2011 13:27:01 -0500
> Subject: RE: shared library in tomcat container runtime`
> 
> > From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> > Subject: RE: shared library in tomcat container runtime`
> 
> > for our own shared lib jars, we have to duplicate them for each
> > deployed apps, even if sometimes the shared lib jars could be 
> > over 100MB. That would really cumbersome!
>  
> Not really; just have your automated script include them when it creates your .war files.  (That part of the distribution process is automated, isn't it?  If not, why not?)  The amount of excess storage consumed is a trivial expense these days, and you will save yourself an incredible amount of grief by not having to deal with versioning synchronization when updating the libraries and webapps.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

RE: shared library in tomcat container runtime`

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> Subject: RE: shared library in tomcat container runtime`

> for our own shared lib jars, we have to duplicate them for each
> deployed apps, even if sometimes the shared lib jars could be 
> over 100MB. That would really cumbersome!
 
Not really; just have your automated script include them when it creates your .war files.  (That part of the distribution process is automated, isn't it?  If not, why not?)  The amount of excess storage consumed is a trivial expense these days, and you will save yourself an incredible amount of grief by not having to deal with versioning synchronization when updating the libraries and webapps.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


RE: shared library in tomcat container runtime`

Posted by Yongqin Xu <yo...@hotmail.com>.
Yes, I am using TC 7.0.12, this virtual webapp loader could be very useful.

> Date: Sat, 23 Apr 2011 00:45:04 +0400
> Subject: Re: shared library in tomcat container runtime`
> From: knst.kolinko@gmail.com
> To: users@tomcat.apache.org
> 
> 2011/4/22 Yongqin Xu <yo...@hotmail.com>:
> >
> > thanks, Churck, that means, for our own shared lib jars, we have to duplicate them for each
> > deployed apps, even if sometimes the shared lib jars could be over 100MB. That would really
> > cumbersome! Does TC has other way around to fix this? WLS does not work that way.
> >
> 
> There is VirtualWebappLoader class, see
> 
> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/VirtualWebappLoader.html
> 
> You aren't saying which Tomcat version you are using.
> 
> Best regards,
> Konstantin Kolinko
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: shared library in tomcat container runtime`

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/4/22 Yongqin Xu <yo...@hotmail.com>:
>
> thanks, Churck, that means, for our own shared lib jars, we have to duplicate them for each
> deployed apps, even if sometimes the shared lib jars could be over 100MB. That would really
> cumbersome! Does TC has other way around to fix this? WLS does not work that way.
>

There is VirtualWebappLoader class, see

http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/loader/VirtualWebappLoader.html

You aren't saying which Tomcat version you are using.

Best regards,
Konstantin Kolinko

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


RE: shared library in tomcat container runtime`

Posted by Yongqin Xu <yo...@hotmail.com>.
thanks, Churck, that means, for our own shared lib jars, we have to duplicate them for each
deployed apps, even if sometimes the shared lib jars could be over 100MB. That would really
cumbersome! Does TC has other way around to fix this? WLS does not work that way.

> From: Chuck.Caldarale@unisys.com
> To: users@tomcat.apache.org
> Date: Fri, 22 Apr 2011 12:12:23 -0500
> Subject: RE: shared library in tomcat container runtime`
> 
> > From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> > Subject: shared library in tomcat container runtime`
> 
> > In runtime, will each app  get its own separate object 
> > instances from the same shared lib jars? Even for those
> > static members of the class, right?
> 
> No; everything in $CATALINA_HOME/lib is handled by a single classloader, so all webapps will share the instances and classes.  If you want separate instances and classes, keep the jars in each webapp's WEB-INF/lib directory.
>  
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

RE: shared library in tomcat container runtime`

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> Subject: shared library in tomcat container runtime`

> In runtime, will each app  get its own separate object 
> instances from the same shared lib jars? Even for those
> static members of the class, right?

No; everything in $CATALINA_HOME/lib is handled by a single classloader, so all webapps will share the instances and classes.  If you want separate instances and classes, keep the jars in each webapp's WEB-INF/lib directory.
 
 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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