On 10.06.2009 15:47, André Warnier wrote:
> Sorry, I mistook "CATALINA_OPTS" for "JAVA_OPTS",
> but
> 
> Bap wrote:
>> Hi André,
>>
>> The solution you have suggested just introduces a new variable, but
>> with exactly the same characteristics of the existing CATALINA_OPTS
>> variable (unless I am missing something.)
> 
> Say that, originally in setenv.sh, you set CATALINA_OPTS as follows (in
> one single line) :
> 
> CATALINA_OPTS='-Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"'
> 
> Then, in catalina.sh, a line such as the following :
> 
> CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
> 
> would make CATALINA_OPTS now be :
> 
> -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
> 
> then, at the next invocation, say here :
> 
> exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS ........
> 
> this would be seen as
> 
> exec (whatever) (whatever_java_opts)
> -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl (whatever_follows)
> 
> which is pretty much what you are seeing, right ?
> 
> Now, what I am trying to tell you is :
> 
> the CATALINA_OPTS variable is used several times in the catalina.sh
> script, in a way that may make it difficult to determine how many times
> it is being so "interpolated" into itself before being finally used.
> Each level of such interpolation, will remove one level of quoting.
> 
> By defining your own variable, and using it just once in catalina.sh, at
> least you know how many times it is being interpolated (just once), and
> you can quote it correctly.
> 
> 
> 
> Now, all this being said, why don't you try this in setenv.sh :
> 
> CATALINA_OPTS='-Dcom.sun.jndi.ldap.connect.pool.protocol=\"plain ssl\"'
> 
> And all of that being said, whoever decided that the property
> "com.sun.jndi.ldap.connect.pool.protocol" could be set to a value with
> embedded spaces ought to be exiled to a remote arctic island.
> Together with whomever invented file paths with embedded spaces.
> Together with whomever decided to install Tomcat by default in
> c:\program files\apache software foundation\.

Adding to what André explains: the following small script shows a
working procedure:

#!/usr/bin/ksh

OPTS=-DXXX="a b"

# or alternatively
# OPTS="-DXXX=a b"

exec /usr/local/jdk1.6.0/bin/java "$OPTS" myprog

What is important here:

- the original variable including the system property is used on the
commandline, no intermediate expansion or adding other tokens to the
same variable

- there is only one system property in the variable. You cann add the
non-problematic ones to the standard variable, or if there are multiple
properties with spaces, use multiple aditional variables.

- The quotes aroung $OPTS in the line starting java. They are used, so
that the shell passes the whole of $OPTS as one argument to the java
process.

The exec is only there, because it is done like that in the standard script.

Regards,

Rainer

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

Reply via email to