You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "N.s.Karthik" <ns...@gmail.com> on 2012/12/27 11:40:47 UTC

New Library folder

Hi

I have multiple web applications  working perfectly on Tomcat 7.0.30
I know that jar files of similar can be moved to  Tomcat /lib folder  so the
same could be shared 
by multiple applications.

I would like to know the configuration details for the following and where 
need to be done ?

A new folder called  "Alphalib"  under Tomcat/lib ,  where all the jars need
to be placed

    eg:  
                 /Tomcat6.0.30 / lib / Alphalib / 1.jar, 2.jar, 3,jar.......

This helps in clear separation of mixing Tomcat/lib/*.jars with application
specific jars.


with regards
N.s.Karthik




--
View this message in context: http://tomcat.10.n6.nabble.com/New-Library-folder-tp4991580.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

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


Re: New Library folder

Posted by Rainer Frey <ra...@inxmail.de>.
On 27.12.2012, at 11:40, N.s.Karthik <ns...@gmail.com> wrote:

> Hi
> 
> I have multiple web applications  working perfectly on Tomcat 7.0.30
> I know that jar files of similar can be moved to  Tomcat /lib folder  so the
> same could be shared 
> by multiple applications.

You know that *your specific jar files* can be moved to tomcat/lib? You'll wanna be really sure of that.
Static references used within these jar files can lead to permgen memory leaks and/or misbehavior (to put it in a grossly simplified way). See various conference talks and presentations by Mark Thomas, and part of following JavaOne session:
https://oracleus.activeevents.com/connect/sessionDetail.ww?SESSION_ID=7905

I think this is only worth the effort in very specific use cases, most commonly a multi tenant service with an instance of (almost) identical web apps per tenant. Just to save a few MB of permgen memory or disk space: don't do it. 

> This helps in clear separation of mixing Tomcat/lib/*.jars with application
> specific jars.

For that purpose, I would not nest your own lib folder within tomcat's lib folder. Place your folder next to the original lib folder, or even outside the tomcat directory.

As Daniel Mikusa already said, you can configure such a folder in conf/catalina.properties by modifying the common.loader property, if you really are determined to do that.

> with regards
> N.s.Karthik

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


Re: New Library folder

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

Daniel,

On 12/27/12 9:16 AM, Daniel Mikusa wrote:
> On Dec 27, 2012, at 5:40 AM, N.s.Karthik wrote:
> 
>> Hi
>> 
>> I have multiple web applications  working perfectly on Tomcat
>> 7.0.30 I know that jar files of similar can be moved to  Tomcat
>> /lib folder  so the same could be shared by multiple
>> applications.
> 
> If it was me, I would not do this.  Your setting yourself up for
> problems and the benefits from doing this are very minimal.  If it
> was me, the only thing I would put in "lib" are JDBC drivers.
> 
> That's me though.  You're certainly free to do whatever.

+1

>> I would like to know the configuration details for the following
>> and where need to be done ?
> 
> Not sure what you mean. If you want to share libraries, just drop 
> them in "lib". No other configuration needed.

OP does not want to "pollute" his Tomcat lib/ folder.

>> A new folder called  "Alphalib"  under Tomcat/lib ,  where all
>> the jars need to be placed
>> 
>> eg: /Tomcat6.0.30 / lib / Alphalib / 1.jar, 2.jar, 3,jar.......
>> 
>> This helps in clear separation of mixing Tomcat/lib/*.jars with
>> application specific jars.
> 
> By default, subfolders are not added to the class loader. Look at 
> "conf/catalina.properties", specifically the "common.loader"
> property to see what paths are added or to add more paths.

Or shared.loader -- it depends on exactly the requirements and the
desired outcome.

> Also, see the following link which explains Tomcat's class loaders
> in detail.
> 
> https://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html

+1

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEAREIAAYFAlDcdOEACgkQ9CaO5/Lv0PAFEACgj07egyqjZqqxMYWBMAQUePAK
XtEAmwWMY1ntueD5WVyVZEsP9XxKwGoH
=7pOE
-----END PGP SIGNATURE-----

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


Re: New Library folder

Posted by Daniel Mikusa <dm...@vmware.com>.
On Dec 27, 2012, at 5:40 AM, N.s.Karthik wrote:

> Hi
> 
> I have multiple web applications  working perfectly on Tomcat 7.0.30
> I know that jar files of similar can be moved to  Tomcat /lib folder  so the
> same could be shared by multiple applications.

If it was me, I would not do this.  Your setting yourself up for problems and the benefits from doing this are very minimal.  If it was me, the only thing I would put in "lib" are JDBC drivers.  

That's me though.  You're certainly free to do whatever.

> 
> I would like to know the configuration details for the following and where 
> need to be done ?

Not sure what you mean.  If you want to share libraries, just drop them in "lib".  No other configuration needed.

> 
> A new folder called  "Alphalib"  under Tomcat/lib ,  where all the jars need
> to be placed
> 
>    eg:  
>                 /Tomcat6.0.30 / lib / Alphalib / 1.jar, 2.jar, 3,jar.......
> 
> This helps in clear separation of mixing Tomcat/lib/*.jars with application
> specific jars.

By default, subfolders are not added to the class loader.  Look at "conf/catalina.properties", specifically the "common.loader" property to see what paths are added or to add more paths.

Also, see the following link which explains Tomcat's class loaders in detail.

  https://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html

Dan


> 
> 
> with regards
> N.s.Karthik
> 
> 
> 
> 
> --
> View this message in context: http://tomcat.10.n6.nabble.com/New-Library-folder-tp4991580.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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