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/27 00:57:01 UTC

tomcat 7: is it possible to config tomcat common classloader to point to other location?

Hello,
I am using TC 7, and the doc says, TC common classloader load $CATALINA_HOME/lib for thosecommonly shared lib jar files. Is it possible for me to config it pointing to other location? I know ifI define $CATALINA_BASE to point to a outside location, will $CATALINA_BASE/lib be used for TCcommon classloader to pick up there? thanks 		 	   		  

RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by Felix Schumacher <fe...@internetallee.de>.
Am Donnerstag, den 05.05.2011, 11:36 -0600 schrieb Yongqin Xu:
> Hello, Churck,
> 
> I tried to use $CATALINA_OPTS env to set my ${oracle.common.home} variable in common.loader property,
> starting TC has no problem, but when shutting down TC, it gives me error saying it could not find the jar. I 
> added echo to print CATALINA_OPTS in catalina.sh script.
> 
> [yoxu@dadvml0008 bin]$ ./startup.sh
> Using CATALINA_OPTS:  -Doracle.common.home=/scratch/yoxu/view_storage/yoxu_maincred/oracle/oracle_common
> Using CATALINA_BASE:   /scratch/yoxu/tomcat/tc-1
> Using CATALINA_HOME:   /scratch/yoxu/tomcat/apache-tomcat-7.0.12
> Using CATALINA_TMPDIR: /scratch/yoxu/tomcat/tc-1/temp
> Using JRE_HOME:        /usr
> Using CLASSPATH:       /scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/bootstrap.jar:/scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/tomcat-juli.jar
> [yoxu@dadvml0008 bin]$ ./shutdown.sh
> Using CATALINA_OPTS:  -Doracle.common.home=/scratch/yoxu/view_storage/yoxu_maincred/oracle/oracle_common
> Using CATALINA_BASE:   /scratch/yoxu/tomcat/tc-1
> Using CATALINA_HOME:   /scratch/yoxu/tomcat/apache-tomcat-7.0.12
> Using CATALINA_TMPDIR: /scratch/yoxu/tomcat/tc-1/temp
> Using JRE_HOME:        /usr
> Using CLASSPATH:       /scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/bootstrap.jar:/scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/tomcat-juli.jar
> May 5, 2011 10:10:39 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
> WARNING: Problem with JAR file [/scratch/yoxu/tomcat/tc-1/bin/${oracle.common.home}/modules/features/adf.share.ca_11.1.1.jar], exists: [false], canRead: [false]
> 
> You can see I tried to set ${oracle.common.home} pointing to a valid location, but
> TC could not recognize it. Do you know what missing? 
$CATALINA_OPTS gets only used at startup. If you need the variable every
time (start and stop), you should use JAVA_OPTS.

Bye
 Felix
> 
> 
> 
> 
> 
> > From: Chuck.Caldarale@unisys.com
> > To: users@tomcat.apache.org
> > Date: Mon, 2 May 2011 23:57:21 -0500
> > Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> > 
> > > From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> > > Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> > 
> > > I mean, can I define my own placeholder there?
> > 
> > It's not a placeholder, it's a reference to a system property, evaluated when the .xml or .properties file is scanned.  Read the doc:
> > 
> > "Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file."
> > 
> > http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
> > 
> >  - 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
> > 
>  		 	   		  



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


RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by Yongqin Xu <yo...@hotmail.com>.
Hello, Churck,

I tried to use $CATALINA_OPTS env to set my ${oracle.common.home} variable in common.loader property,
starting TC has no problem, but when shutting down TC, it gives me error saying it could not find the jar. I 
added echo to print CATALINA_OPTS in catalina.sh script.

[yoxu@dadvml0008 bin]$ ./startup.sh
Using CATALINA_OPTS:  -Doracle.common.home=/scratch/yoxu/view_storage/yoxu_maincred/oracle/oracle_common
Using CATALINA_BASE:   /scratch/yoxu/tomcat/tc-1
Using CATALINA_HOME:   /scratch/yoxu/tomcat/apache-tomcat-7.0.12
Using CATALINA_TMPDIR: /scratch/yoxu/tomcat/tc-1/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/bootstrap.jar:/scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/tomcat-juli.jar
[yoxu@dadvml0008 bin]$ ./shutdown.sh
Using CATALINA_OPTS:  -Doracle.common.home=/scratch/yoxu/view_storage/yoxu_maincred/oracle/oracle_common
Using CATALINA_BASE:   /scratch/yoxu/tomcat/tc-1
Using CATALINA_HOME:   /scratch/yoxu/tomcat/apache-tomcat-7.0.12
Using CATALINA_TMPDIR: /scratch/yoxu/tomcat/tc-1/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/bootstrap.jar:/scratch/yoxu/tomcat/apache-tomcat-7.0.12/bin/tomcat-juli.jar
May 5, 2011 10:10:39 AM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with JAR file [/scratch/yoxu/tomcat/tc-1/bin/${oracle.common.home}/modules/features/adf.share.ca_11.1.1.jar], exists: [false], canRead: [false]

You can see I tried to set ${oracle.common.home} pointing to a valid location, but
TC could not recognize it. Do you know what missing? 





> From: Chuck.Caldarale@unisys.com
> To: users@tomcat.apache.org
> Date: Mon, 2 May 2011 23:57:21 -0500
> Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> 
> > From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> > Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> 
> > I mean, can I define my own placeholder there?
> 
> It's not a placeholder, it's a reference to a system property, evaluated when the .xml or .properties file is scanned.  Read the doc:
> 
> "Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file."
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
> 
>  - 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: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?

> I mean, can I define my own placeholder there?

It's not a placeholder, it's a reference to a system property, evaluated when the .xml or .properties file is scanned.  Read the doc:

"Apache Ant-style variable substitution is supported; a system property with the name propname may be used in a configuration file using the syntax ${propname}. All system properties are available including those set using the -D syntax, those automatically made available by the JVM and those configured in the $CATALINA_BASE/conf/catalina.properties file."

http://tomcat.apache.org/tomcat-7.0-doc/config/index.html

 - 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: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by Yongqin Xu <yo...@hotmail.com>.
I mean, can I define my own placeholder there? like ${foo.bar}, so that I don't have to hardcode catalina.propertiesto let TC include my external jars? Is there mapping like CATALINA_BASE -> catalina.base, and CATALINA_HOME -> catalina.home,or FOO_BAR -> foo.bar?

> From: Chuck.Caldarale@unisys.com
> To: users@tomcat.apache.org
> Date: Mon, 2 May 2011 23:39:59 -0500
> Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> 
> > From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> > Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> 
> > If "common.loader" map to common classloader, what "shared.loader" get map to? 
> 
> Nothing, unless you change catalina.properties.  Tomcat 5.5 and earlier used the shared loader, but it was de-configured in Tomcat 6.0 and later.
> 
> > And are those  ${catalina.base} and ${catalina.home} built-in placeholder for TC7?
> 
> Not sure what you mean by "built-in placelholder"; they are properties that undergo variable substitution when the file is loaded and parsed.  Read RUNNING.txt in Tomcat's home directory for an explanation.
> 
>  - 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: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Yongqin Xu [mailto:yongqxu@hotmail.com] 
> Subject: RE: tomcat 7: is it possible to config tomcat common classloader to point to other location?

> If "common.loader" map to common classloader, what "shared.loader" get map to? 

Nothing, unless you change catalina.properties.  Tomcat 5.5 and earlier used the shared loader, but it was de-configured in Tomcat 6.0 and later.

> And are those  ${catalina.base} and ${catalina.home} built-in placeholder for TC7?

Not sure what you mean by "built-in placelholder"; they are properties that undergo variable substitution when the file is loaded and parsed.  Read RUNNING.txt in Tomcat's home directory for an explanation.

 - 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: tomcat 7: is it possible to config tomcat common classloader to point to other location?

Posted by Yongqin Xu <yo...@hotmail.com>.
Thank you, Chris, in catalina.properties file, I also saw shared.loader property,  as you know, the TC7 doc says "System", "Common", and "Webapp" classloaders. If "common.loader" map to common classloader, what "shared.loader" get map to? 
And are those  ${catalina.base} and ${catalina.home} built-in placeholder for TC7?

> Date: Thu, 28 Apr 2011 11:06:01 -0400
> From: chris@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: tomcat 7: is it possible to config tomcat common classloader to point to other location?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Yongqin,
> 
> On 4/26/2011 6:57 PM, Yongqin Xu wrote:
> > I am using TC 7, and the doc says, TC common classloader load
> > $CATALINA_HOME/lib for thosecommonly shared lib jar files. Is it
> > possible for me to config it pointing to other location? I know ifI
> > define $CATALINA_BASE to point to a outside location, will
> > $CATALINA_BASE/lib be used for TCcommon classloader to pick up there?
> 
> Take a look at conf/catalina.properties:
> 
> common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar
> 
> Looks like both are used.
> 
> You can define this property to be anything you'd like, including adding
> another directory somewhere else without disturbing anything.
> 
> Note that changing catalina.properties will be surprising to anyone who
> tries to debug your Tomcat installation after you move-on to another
> job. So, be sure to explicitly document what you're doing.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk25glkACgkQ9CaO5/Lv0PDdTQCdGIjx93eqJl8/qr6ZjjcW41kQ
> zXMAn0sSANteGM+OWHCvvWxBK2os+13a
> =kfal
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: tomcat 7: is it possible to config tomcat common classloader to point to other location?

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

Yongqin,

On 4/26/2011 6:57 PM, Yongqin Xu wrote:
> I am using TC 7, and the doc says, TC common classloader load
> $CATALINA_HOME/lib for thosecommonly shared lib jar files. Is it
> possible for me to config it pointing to other location? I know ifI
> define $CATALINA_BASE to point to a outside location, will
> $CATALINA_BASE/lib be used for TCcommon classloader to pick up there?

Take a look at conf/catalina.properties:

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar

Looks like both are used.

You can define this property to be anything you'd like, including adding
another directory somewhere else without disturbing anything.

Note that changing catalina.properties will be surprising to anyone who
tries to debug your Tomcat installation after you move-on to another
job. So, be sure to explicitly document what you're doing.

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

iEYEARECAAYFAk25glkACgkQ9CaO5/Lv0PDdTQCdGIjx93eqJl8/qr6ZjjcW41kQ
zXMAn0sSANteGM+OWHCvvWxBK2os+13a
=kfal
-----END PGP SIGNATURE-----

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