tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Different handling of -Dfoo="bar" between versions
Date Thu, 03 Oct 2013 20:03:50 GMT
Steve Arch (sarch) wrote:
> I've found a bit more explanation. You are indeed correct - AWS has their own custom
tomcat startup scripts that override the default tomcat startup scripts to handle the quotes.
The yum update reverts to the default tomcat scripts and introduces the ambiguity.
> 
> Thanks for the help.
> 
> Steve
> 
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Sent: Thursday, October 03, 2013 4:25 PM
> To: Tomcat Users List
> Subject: Re: Different handling of -Dfoo="bar" between versions
> 
> Steve,
> 
> On 10/3/13 11:12 AM, Steve Arch (sarch) wrote:
>>>> AWS's tools pass the values to tomcat.
>>> This is not an adequate description.  Tomcat must be launched by some 
>>> mechanism, such as the java executable, JSVC service wrapper, class 
>>> loading from some already >running Java application, etc.  What's 
>>> being used here?
>> OK, in this case 'magic' is being used. The running process is:
>>
>> /usr/lib/jvm/jre/bin/java -Dfoo="bar" -XX:MaxPermSize=64m -Xmx256m 
>> -Xms256m -classpath 
>> /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-jul
>> i.jar:/usr/share/java/commons-daemon.jar
>>
>>
> -Dcatalina.base=/usr/share/tomcat7 -Dcatalina.home=/usr/share/tomcat7
>> -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat7/temp
>> -Djava.util.logging.config.file=/usr/share/tomcat7/conf/logging.proper
>> ties
>>
>>
...
I think that the basic misunderstanding here is simply this :
The executable program that is being launched by the above command-line is not Tomcat.
It is "/usr/lib/jvm/jre/bin/java".
All the rest of the command-line options and parameters are options and parameters for
  "/usr/lib/jvm/jre/bin/java", and are parsed by "/usr/lib/jvm/jre/bin/java".
Including the -Dfoo="bar".

Correction : what you see with the "ps" display is the command that was used to launch 
that process, *after* the original command-line was parsed by whatever shell was in use.
So if that shell was a Unix shell, the original command-line may have included
(as one of the possibilities) '-Dfoo="bar"' (or : -Dfoo=\"bar\" - and there are a few more

esoteric possibilities too).

In any case, java reads the -Dfoo="bar", and sets the corresponding internal java system 
property.

And then, later, java "runs tomcat".

And then, later, some java code in Tomcat asks for the value of the property "foo", and 
gets this value from the JVM that is running it (/usr/lib/jvm/jre/bin/java).
And it gets whatever the JVM thinks it is.
If the JVM thinks it is bar, then Tomcat gets bar.  If the JVM thinks it is "bar", then 
Tomcat will get "bar".

So it has nothing to do with Tomcat per se or any of its versions.
It happens "before".


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


Mime
View raw message