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/05/10 07:01:25 UTC

tomcat 7: common.loader property in catalina.properties does not take ANT style variable

The default common.loader property has${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jarI added my own entries like ${oracle.home}/lib/*.jar, and set $JAVA_OPTS=-Doracle.home=/usr/local/oracle, then start tomcat 7 and stop tomcat 7, the stop complaints that ${oracle.home} is not valid path, butphysically it is valid. I am sure there is no typo.
Further more, i intentionally changed catalina.sh for those sections of setting -Dcatalina.base=$CATALINA_BASEfor starting Tomcat 7, like I changed it to "-Dcatalina.bas",  it all has no impact to this common.loader at all.Looks like Tomcat populate catalina.base and catalina.home internally, does anyone know how Tomcat set this ANT style variable during start/stop? thanks 		 	   		  

RE: tomcat 7: common.loader property in catalina.properties does not take ANT style variable

Posted by Yongqin Xu <yo...@hotmail.com>.
Assume you have TC7 installed and configured.1. put a any jar to your separate local path, such as /home/foo/lib/food.jar2. edit $CATALINA_HOME/conf/catalina.properties to apend "${foo.bar}/lib/food.jar" to common.loader property3, setenv JAVA_OPTS -Dfoo.bar=/home/foo4. start TC7, then stop TC7, you will see the warning complaining it could not find $CATALINA_HOME/bin/${foo.bar}/lib/food.jar    not found.
Of course, if in a deployed app where using any classes in food.jar is not available for sure.

> Date: Tue, 10 May 2011 16:31:13 -0400
> From: chris@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: tomcat 7: common.loader property in catalina.properties does not take ANT style variable
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Konstantin,
> 
> On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
> > IIRC, catalina.properties file does not support substitution for
> > anything, besides those two specific properties, "catalina.home" and
> > "catalina.base".
> 
> The documentation suggests otherwise:
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
> 
> "
> Tomcat configuration files are formatted as schemaless XML; elements and
> attributes are case-sensitive. 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.
> "
> 
> Yongqin, can you provide a simple example that we can try to reproduce?
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk3JoJAACgkQ9CaO5/Lv0PD4RACgv7crIJszHl0xeOsEARLACrL0
> Lv0AnRRQKjfHkdfkpigZXHtmnFqk+80+
> =Ijtl
> -----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: common.loader property in catalina.properties does not take ANT style variable

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/5/11 Yongqin Xu <yo...@hotmail.com>:
>
> I would love to see that happen. thanks.
>
>> Date: Wed, 11 May 2011 10:01:48 -0400
>> From: chris@christopherschultz.net
>> To: users@tomcat.apache.org
>> Subject: Re: tomcat 7: common.loader property in catalina.properties does not take ANT style variable
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Konstantin,
>>
>> On 5/10/2011 4:50 PM, Konstantin Kolinko wrote:
>> > 2011/5/11 Christopher Schultz <ch...@christopherschultz.net>:
>> >> On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
>> >>> IIRC, catalina.properties file does not support substitution for
>> >>> anything, besides those two specific properties, "catalina.home" and
>> >>> "catalina.base".
>> >>
>> >> The documentation suggests otherwise:
>> >>
>> >> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
>> >>
>> >> "
>> >> Tomcat configuration files are formatted as schemaless XML; elements (...)
>> >
>> > The said file is not an XML one. The above quote is not applicable.
>>
>> Upon second reading of that passage, you're right: though
>> catalina.properties is mentioned, it's (somewhat) clear than it can be
>> used to /define/ properties, but does not enjoy the
>> system-property-replacements used in those other files.
>>
>> It makes sense, given that otherwise there would be a terrible circular
>> logic problem when reading catalina.properties. I suppose, eventually,
>> you'd either evaluate all system properties or detect a loop and could
>> bail-out.
>>
>> If this seems like something the community would like, I wouldn't mind
>> writing a patch to allow this type of thing.
>>
>> - -chris

https://issues.apache.org/bugzilla/show_bug.cgi?id=50677#c5
Implemented and will be in 7.0.17.

Best regards,
Konstantin Kolinko

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


RE: tomcat 7: common.loader property in catalina.properties does not take ANT style variable

Posted by Yongqin Xu <yo...@hotmail.com>.
I would love to see that happen. thanks.

> Date: Wed, 11 May 2011 10:01:48 -0400
> From: chris@christopherschultz.net
> To: users@tomcat.apache.org
> Subject: Re: tomcat 7: common.loader property in catalina.properties does not take ANT style variable
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Konstantin,
> 
> On 5/10/2011 4:50 PM, Konstantin Kolinko wrote:
> > 2011/5/11 Christopher Schultz <ch...@christopherschultz.net>:
> >> On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
> >>> IIRC, catalina.properties file does not support substitution for
> >>> anything, besides those two specific properties, "catalina.home" and
> >>> "catalina.base".
> >>
> >> The documentation suggests otherwise:
> >>
> >> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
> >>
> >> "
> >> Tomcat configuration files are formatted as schemaless XML; elements (...)
> > 
> > The said file is not an XML one. The above quote is not applicable.
> 
> Upon second reading of that passage, you're right: though
> catalina.properties is mentioned, it's (somewhat) clear than it can be
> used to /define/ properties, but does not enjoy the
> system-property-replacements used in those other files.
> 
> It makes sense, given that otherwise there would be a terrible circular
> logic problem when reading catalina.properties. I suppose, eventually,
> you'd either evaluate all system properties or detect a loop and could
> bail-out.
> 
> If this seems like something the community would like, I wouldn't mind
> writing a patch to allow this type of thing.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk3KlswACgkQ9CaO5/Lv0PCt6gCfcVCUB9mqcPe61sWY+MQAVzUy
> sXUAoK8WOU4w9R7lu8+FE0jaJw/sbkC0
> =QET0
> -----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: common.loader property in catalina.properties does not take ANT style variable

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

Konstantin,

On 5/10/2011 4:50 PM, Konstantin Kolinko wrote:
> 2011/5/11 Christopher Schultz <ch...@christopherschultz.net>:
>> On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
>>> IIRC, catalina.properties file does not support substitution for
>>> anything, besides those two specific properties, "catalina.home" and
>>> "catalina.base".
>>
>> The documentation suggests otherwise:
>>
>> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
>>
>> "
>> Tomcat configuration files are formatted as schemaless XML; elements (...)
> 
> The said file is not an XML one. The above quote is not applicable.

Upon second reading of that passage, you're right: though
catalina.properties is mentioned, it's (somewhat) clear than it can be
used to /define/ properties, but does not enjoy the
system-property-replacements used in those other files.

It makes sense, given that otherwise there would be a terrible circular
logic problem when reading catalina.properties. I suppose, eventually,
you'd either evaluate all system properties or detect a loop and could
bail-out.

If this seems like something the community would like, I wouldn't mind
writing a patch to allow this type of thing.

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

iEYEARECAAYFAk3KlswACgkQ9CaO5/Lv0PCt6gCfcVCUB9mqcPe61sWY+MQAVzUy
sXUAoK8WOU4w9R7lu8+FE0jaJw/sbkC0
=QET0
-----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: common.loader property in catalina.properties does not take ANT style variable

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/5/11 Christopher Schultz <ch...@christopherschultz.net>:
> On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
>> IIRC, catalina.properties file does not support substitution for
>> anything, besides those two specific properties, "catalina.home" and
>> "catalina.base".
>
> The documentation suggests otherwise:
>
> http://tomcat.apache.org/tomcat-7.0-doc/config/index.html
>
> "
> Tomcat configuration files are formatted as schemaless XML; elements (...)

The said file is not an XML one. The above quote is not applicable.

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


Re: tomcat 7: common.loader property in catalina.properties does not take ANT style variable

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

Konstantin,

On 5/10/2011 3:05 AM, Konstantin Kolinko wrote:
> IIRC, catalina.properties file does not support substitution for
> anything, besides those two specific properties, "catalina.home" and
> "catalina.base".

The documentation suggests otherwise:

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

"
Tomcat configuration files are formatted as schemaless XML; elements and
attributes are case-sensitive. 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.
"

Yongqin, can you provide a simple example that we can try to reproduce?

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

iEYEARECAAYFAk3JoJAACgkQ9CaO5/Lv0PD4RACgv7crIJszHl0xeOsEARLACrL0
Lv0AnRRQKjfHkdfkpigZXHtmnFqk+80+
=Ijtl
-----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: common.loader property in catalina.properties does not take ANT style variable

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/5/10 Yongqin Xu <yo...@hotmail.com>:
>
> The default common.loader property has${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jarI added my own entries like ${oracle.home}/lib/*.jar, and set $JAVA_OPTS=-Doracle.home=/usr/local/oracle, then start tomcat 7 and stop tomcat 7, the stop complaints that ${oracle.home} is not valid path, butphysically it is valid. I am sure there is no typo.

IIRC, catalina.properties file does not support substitution for
anything, besides those two specific properties, "catalina.home" and
"catalina.base".

> Further more, i intentionally changed catalina.sh for those sections of setting -Dcatalina.base=$CATALINA_BASEfor starting Tomcat 7, like I changed it to "-Dcatalina.bas",  it all has no impact to this common.loader at all.Looks like Tomcat populate catalina.base and catalina.home internally, does anyone know how Tomcat set this ANT style variable during start/stop? thanks

If no "catalina.base" is defined then it defaults to be the same as
catalina.home. You can see the source code of the Bootstrap and
CatalinaProperties classes in org.apache.catalina.startup package.


Best regards,
Konstantin Kolinko

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