tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Arch (sarch)" <sa...@cisco.com>
Subject RE: Different handling of -Dfoo="bar" between versions
Date Thu, 03 Oct 2013 15:12:45 GMT
>> 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-juli.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.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap
start

>> I supply a set of key:value pairs and AWS (ElasticBeanstalk) passes 
>> them to tomcat via the command line.

>Exactly what command line?  Tomcat itself is just a set of class files, not an executable.

Tomcat is launched by some magic which may as well boil down to launching from the command
line:
/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-juli.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.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap
start

>> Something has changed between version 24 and 37 in Tomcat when it 
>> parses the JVM options (-D).

>Again, Tomcat does not parse command line options and has absolutely nothing to do with
the JRE-supplied System class.  The launcher used to start Tomcat does parse the >command
line; Tomcat has no built-in launcher.

Whatever parses the command line has not changed between versions of tomcat. At some stage,
part or all of -Dfoo="bar" makes its way through to Tomcat. On tomcat 7.0.24, this results
in the environment parameter 'foo' being set to 'bar'. On Tomcat 7.0.37, this results in the
environment parameter 'foo' being set to '"bar"'.

>> Mikolaj's response says that the input was illegal anyway (quotes have 
>> to surround the whole string: "-Dfoo=bar" or "-Dfoo=bar bar" rather 
>> than -Dfoo="bar bar").

>> As long as I know that -Dfoo="bar" is illegal syntax

>It's not illegal (and Mikolaj never said it was), but it may not be what you want.  When
quotes come after the equals sign, they are part of the value; quotes surrounding the >entire
expression are stripped off by the shell when creating the argument list for the executable.

Maybe should have said 'wrong' rather than 'illegal' but if the correct behaviour of -Dfoo="bar"
is for the system parameter 'foo' to be set to '"bar"' (with the quotes) then I can raise
a bug with AWS. If the correct behaviour of is for 'foo' to be set to 'bar' (without the quotes)
then I'll raise a bug with Tomcat. TBH I don't care which is 'correct' as long as I know which
one is and can chase up the bug with someone. 


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


Mime
View raw message