Re: setenv.sh - how to set system properties to values containingspaces

2009-06-10 Thread Rainer Jung
On 10.06.2009 15:09, 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.)
 
 The issue is, that even when the CATALINA_OPTS value looks like it is
 correctly quoted (echo of CATALINA_OPTS below), when java is invoked, it
 gets the system property com.sun.jndi.ldap.connect.pool.protocol set to
 plain and the next argument is ssl which it expects to be the class
 containing main.
 
 -Xms128m -Xmx256m -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl
 -Dcom.sun.jndi.ldap.connect.pool.timeout=1
 
 Thanks for the suggestion,
 Bap.
 
 Quoting André Warnier a...@ice-sa.com:
 
 Bap wrote:
 ...
 Looks very much like the problem from hell, where the number of extra
 quoting levels depends on the number of times this thing ends up being
 interpolated.

 A suggestion, which involves modifying catalina.sh, but maybe with
 less nefarious effects if it ever gets replaced :

 - modify catalina.sh such that, in each command-line executing Tomcat
 and in which $JAVA_OPTS is invoked, you add another $MY_JAVA_OPTS
 after the $JAVA_OPTS.
 - then define MY_JAVA_OPTS in setenv.sh, with what you want as
 additional options, using only 1 level of additional quoting.

 e.g.

exec $_RUNJAVA $JAVA_OPTS $CATALINA_OPTS \

 becomes

exec $_RUNJAVA $JAVA_OPTS $MY_JAVA_OPTS $CATALINA_OPTS \

 and in setenv.sh :

 MY_JAVA_OPTS=-Dsomeparam=\this and that\
 or
 MY_JAVA_OPTS='-Dsomeparam=this and that'

I know that's not the solution you are looking for, but you can add
system properties in the form

key=value

to the file conf/catalina.properties.

They will automatically be added by Tomcat to the System properties, so
they will be visible to your webapps.

I didn't play around with whitespace there, but at least there's no
shell token expansion involved in catalina.properties and you don't have
to hardcode the flags into your catalina.sh.

In your speciaql case it is not clear, how early during bootstrap the
code which is looking for the properties runs (whether Tomcat already
handled the catalina.properties file), but it is worth a try.

Regards,

Rainer

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



Re: setenv.sh - how to set system properties to values containingspaces

2009-06-10 Thread Bap

Thank you,

Unfortunately I think I will have to go with this suggestion,  
setenv.sh does not look like it will bear fruit.


Thanks again,
Bap.

Quoting Rainer Jung rainer.j...@kippdata.de:


On 10.06.2009 15:09, 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.)

The issue is, that even when the CATALINA_OPTS value looks like it is
correctly quoted (echo of CATALINA_OPTS below), when java is invoked, it
gets the system property com.sun.jndi.ldap.connect.pool.protocol set to
plain and the next argument is ssl which it expects to be the class
containing main.

-Xms128m -Xmx256m -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl
-Dcom.sun.jndi.ldap.connect.pool.timeout=1

Thanks for the suggestion,
Bap.

Quoting André Warnier a...@ice-sa.com:


Bap wrote:
...
Looks very much like the problem from hell, where the number of extra
quoting levels depends on the number of times this thing ends up being
interpolated.

A suggestion, which involves modifying catalina.sh, but maybe with
less nefarious effects if it ever gets replaced :

- modify catalina.sh such that, in each command-line executing Tomcat
and in which $JAVA_OPTS is invoked, you add another $MY_JAVA_OPTS
after the $JAVA_OPTS.
- then define MY_JAVA_OPTS in setenv.sh, with what you want as
additional options, using only 1 level of additional quoting.

e.g.

   exec $_RUNJAVA $JAVA_OPTS $CATALINA_OPTS \

becomes

   exec $_RUNJAVA $JAVA_OPTS $MY_JAVA_OPTS $CATALINA_OPTS \

and in setenv.sh :

MY_JAVA_OPTS=-Dsomeparam=\this and that\
or
MY_JAVA_OPTS='-Dsomeparam=this and that'


I know that's not the solution you are looking for, but you can add
system properties in the form

key=value

to the file conf/catalina.properties.

They will automatically be added by Tomcat to the System properties, so
they will be visible to your webapps.

I didn't play around with whitespace there, but at least there's no
shell token expansion involved in catalina.properties and you don't have
to hardcode the flags into your catalina.sh.

In your speciaql case it is not clear, how early during bootstrap the
code which is looking for the properties runs (whether Tomcat already
handled the catalina.properties file), but it is worth a try.

Regards,

Rainer

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





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