You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sarva <ma...@yahoo.in> on 2009/06/03 10:13:31 UTC

How to reference Shared Libraries with TOMCAT

Till now I have been deploying all the JARs in WEB-INF/lib folder of my Web
Application and run it to satisfaction.
Now we need a mechanism by which the JARs will not be stored in WEB-INF/lib
but in a centralized location for example c:/lib, and all tomcat Web
Applications should refer to this folder for all JARs required during
runtime.  How can I do this.

Thanks

Sarva
-- 
View this message in context: http://www.nabble.com/How-to-reference-Shared-Libraries-with-TOMCAT-tp23847320p23847320.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: How to reference Shared Libraries with TOMCAT

Posted by Peter Crowther <Pe...@melandra.com>.
> From: Sarva [mailto:malhotrasarva@yahoo.in]
> Till now I have been deploying all the JARs in WEB-INF/lib
> folder of my Web Application and run it to satisfaction.

OK.

> Now we need a mechanism by which the JARs will not be stored
> in WEB-INF/lib
> but in a centralized location for example c:/lib, and all tomcat Web
> Applications should refer to this folder for all JARs required during
> runtime.

Why?  You will make a maintenance nightmare for yourself when the version of a jar changes for one application, but another application still needs the old version.

> How can I do this.

Depends on your Tomcat version, which you didn't bother to tell us.

                - Peter

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


Re: How to reference Shared Libraries with TOMCAT

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

Chuck,

On 6/3/2009 11:31 AM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: How to reference Shared Libraries with TOMCAT
>> 
>> # First clear out the user classpath CLASSPATH=
> 
> But not on Windows.  The corresponding Windows script only sets
> CLASSPATH if running with a JDK and it can find tools.jar

No, it doesn't: it looks for either the JRE or the JDK and bails out
otherwise. After that, this occurs, without precondition (checked
versions 5.5.26):

set CLASSPATH=%JAVA_HOME%\lib\tools.jar

Yes, it's silly that tools.jar is included in the CLASSPATH, but the
upshot is that any pre-set CLASSPATH is killed.

I don't know how win32 services are affected: they are probably toast.

UPDATE:
I checked 6.0.18 and it appears that the script has been changed to
reflect your assertion:

"
if not exist "%JAVA_HOME%\lib\tools.jar" goto noJavac
set CLASSPATH=%JAVA_HOME%\lib\tools.jar
:noJavac
"

That's certainly odd.

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

iEYEARECAAYFAkon/dgACgkQ9CaO5/Lv0PAjNACgo0kU5ySzmJG2DD9MEydks0MV
R94AoIvCFH7XTOi1fQzmg1kaEASzwjD3
=rjth
-----END PGP SIGNATURE-----

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


RE: How to reference Shared Libraries with TOMCAT

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Subject: Re: How to reference Shared Libraries with TOMCAT
> 
> # First clear out the user classpath
> CLASSPATH=

But not on Windows.  The corresponding Windows script only sets CLASSPATH if running with a JDK and it can find tools.jar (which is odd, since Tomcat no longer uses javac).  Under any other conditions (such as running with a JRE), the CLASSPATH is left untouched.

Setting CLASSPATH globally (which a quicktime install does) can be disastrous for other programs, if not Tomcat; that environment variable has long outlived its usefulness.

 - 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.


Re: How to reference Shared Libraries with TOMCAT

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

Chuck,

On 6/3/2009 10:15 AM, Caldarale, Charles R wrote:
> Don't *EVER* set the CLASSPATH environment variable - that causes no
> end of grief, and plays havoc with Tomcat's classloading
> requirements.

It really shouldn't interfere: it should actually have no effect at all.
startup.sh calls catalina.sh which calls setclasspath.sh and at the
beginning of that script is

# First clear out the user classpath
CLASSPATH=

Now, of course, anyone can modify these scripts and totally screw
everything up, but simply setting the CLASSPATH environment variable at
the command prompt will have no effect on Tomcat.

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

iEYEARECAAYFAkomi8AACgkQ9CaO5/Lv0PAEhgCfVJMyczZ4XigChldyN/mNP8td
xqMAoLLTn3NriBHg/6gz83vaKFBdsVZm
=b4UO
-----END PGP SIGNATURE-----

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


Re: How to reference Shared Libraries with TOMCAT

Posted by David Kerber <dc...@verizon.net>.
Caldarale, Charles R wrote:
>> From: Zeeshan Ahmad [mailto:zahmad@i2cinc.com]
>> Subject: RE: How to reference Shared Libraries with TOMCAT
>>
>> If you have multiple tomcats and multiple applications then 
>> you have to put the jars on a separate location
>>     
>
> As Peter pointed out, doing so is a really bad idea.  The OP should continue to run what's working, with the jars duplicated in each webapp's WEB-INF/lib directory.  Anything else is extremely problematic.
>   
Yeah, I once tried having a single lib location for the common jars, and 
while I could get it working, it was quite fragile, and I ended up 
giving each webapp its own copy of the libraries in question.  It's been 
much more robust since then.

D



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


RE: How to reference Shared Libraries with TOMCAT

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Zeeshan Ahmad [mailto:zahmad@i2cinc.com]
> Subject: RE: How to reference Shared Libraries with TOMCAT
> 
> If you have multiple tomcats and multiple applications then 
> you have to put the jars on a separate location

As Peter pointed out, doing so is a really bad idea.  The OP should continue to run what's working, with the jars duplicated in each webapp's WEB-INF/lib directory.  Anything else is extremely problematic.

> and add these in class path environment

Don't *EVER* set the CLASSPATH environment variable - that causes no end of grief, and plays havoc with Tomcat's classloading requirements.

 - 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: How to reference Shared Libraries with TOMCAT

Posted by Zeeshan Ahmad <za...@i2cinc.com>.
If you have multiple tomcats and multiple applications then you have to put
the jars on a separate location and add these in class path environment
before starting any of the tomcat, it will work for more then one tomcats
and more then one applications, thanks.

Best Regards,
Zeeshan Ahmad.
Associate Manager SCM.
 
P Save a tree...pls don't print this e-mail unless necessary 

-----Original Message-----
From: Ghufran [mailto:ghufran.a@vopium.com] 
Sent: Wednesday, June 03, 2009 4:08 PM
To: 'Tomcat Users List'
Subject: RE: How to reference Shared Libraries with TOMCAT

In tomcat 6.x, put the jars in <tomcat-home-dir>/lib  and all the web
applications in that tomcat will start sharing the jars.

 

 

Regards

Ghufran Ul Haq

 

 

-----Original Message-----
From: Zeeshan Ahmad [mailto:zahmad@i2cinc.com] 
Sent: Wednesday, June 03, 2009 1:40 PM
To: 'Tomcat Users List'
Subject: RE: How to reference Shared Libraries with TOMCAT

 

Hello,

 

You need to add those JAR files on central location add these files in Class

Path (its better if you make a environment script), so when will you start

your applications it will load JARs from there, thanks.

 

Best Regards,

Zeeshan Ahmad.

Associate Manager SCM.

 

P Save a tree...pls don't print this e-mail unless necessary 

 

-----Original Message-----

From: Sarva [mailto:malhotrasarva@yahoo.in] 

Sent: Wednesday, June 03, 2009 2:14 PM

To: users@tomcat.apache.org

Subject: How to reference Shared Libraries with TOMCAT

 

 

Till now I have been deploying all the JARs in WEB-INF/lib folder of my Web

Application and run it to satisfaction.

Now we need a mechanism by which the JARs will not be stored in WEB-INF/lib

but in a centralized location for example c:/lib, and all tomcat Web

Applications should refer to this folder for all JARs required during

runtime.  How can I do this.

 

Thanks

 

Sarva

-- 

View this message in context:

http://www.nabble.com/How-to-reference-Shared-Libraries-with-TOMCAT-tp238473

20p23847320.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

 

No virus found in this incoming message.

Checked by AVG - www.avg.com 

Version: 8.5.339 / Virus Database: 270.12.44/2140 - Release Date: 06/02/09
17:53:00



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


RE: How to reference Shared Libraries with TOMCAT

Posted by Ghufran <gh...@vopium.com>.
In tomcat 6.x, put the jars in <tomcat-home-dir>/lib  and all the web
applications in that tomcat will start sharing the jars.

 

 

Regards

Ghufran Ul Haq

 

 

-----Original Message-----
From: Zeeshan Ahmad [mailto:zahmad@i2cinc.com] 
Sent: Wednesday, June 03, 2009 1:40 PM
To: 'Tomcat Users List'
Subject: RE: How to reference Shared Libraries with TOMCAT

 

Hello,

 

You need to add those JAR files on central location add these files in Class

Path (its better if you make a environment script), so when will you start

your applications it will load JARs from there, thanks.

 

Best Regards,

Zeeshan Ahmad.

Associate Manager SCM.

 

P Save a tree...pls don't print this e-mail unless necessary 

 

-----Original Message-----

From: Sarva [mailto:malhotrasarva@yahoo.in] 

Sent: Wednesday, June 03, 2009 2:14 PM

To: users@tomcat.apache.org

Subject: How to reference Shared Libraries with TOMCAT

 

 

Till now I have been deploying all the JARs in WEB-INF/lib folder of my Web

Application and run it to satisfaction.

Now we need a mechanism by which the JARs will not be stored in WEB-INF/lib

but in a centralized location for example c:/lib, and all tomcat Web

Applications should refer to this folder for all JARs required during

runtime.  How can I do this.

 

Thanks

 

Sarva

-- 

View this message in context:

http://www.nabble.com/How-to-reference-Shared-Libraries-with-TOMCAT-tp238473

20p23847320.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

 

No virus found in this incoming message.

Checked by AVG - www.avg.com 

Version: 8.5.339 / Virus Database: 270.12.44/2140 - Release Date: 06/02/09
17:53:00


RE: How to reference Shared Libraries with TOMCAT

Posted by Zeeshan Ahmad <za...@i2cinc.com>.
Hello,

You need to add those JAR files on central location add these files in Class
Path (its better if you make a environment script), so when will you start
your applications it will load JARs from there, thanks.

Best Regards,
Zeeshan Ahmad.
Associate Manager SCM.
 
P Save a tree...pls don't print this e-mail unless necessary 

-----Original Message-----
From: Sarva [mailto:malhotrasarva@yahoo.in] 
Sent: Wednesday, June 03, 2009 2:14 PM
To: users@tomcat.apache.org
Subject: How to reference Shared Libraries with TOMCAT


Till now I have been deploying all the JARs in WEB-INF/lib folder of my Web
Application and run it to satisfaction.
Now we need a mechanism by which the JARs will not be stored in WEB-INF/lib
but in a centralized location for example c:/lib, and all tomcat Web
Applications should refer to this folder for all JARs required during
runtime.  How can I do this.

Thanks

Sarva
-- 
View this message in context:
http://www.nabble.com/How-to-reference-Shared-Libraries-with-TOMCAT-tp238473
20p23847320.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