You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2009/06/09 21:02:45 UTC

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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bap,

On 6/9/2009 1:06 PM, Bap wrote:
> I am trying to set the following system property/value in setenv.sh
> com.sun.jndi.ldap.connect.pool.protocol="plain ssl"

> If I enclose the whole CATALINA_OPTS in single quotes, then the value
> looks fine when echoed, but the catalina.out contains Exception in
> thread "main" java.lang.NoClassDefFoundError: ssl"

> The complete contents of setenv.sh is the single line below.
> CATALINA_OPTS='-Xms128m -Xmx256m
> -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
> -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'

So, the above echos fine but causes the NoClassDefFoundError?

Try any one of the following, which might work:

CATALINA_OPTS="-Xms128m -Xmx256m
- -Dcom.sun.jndi.ldap.connect.pool.protocol=plain\ ssl
- -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"
CATALINA_OPTS='-Xms128m -Xmx256m
- -Dcom.sun.jndi.ldap.connect.pool.protocol=plain\ ssl
- -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'
CATALINA_OPTS="-Xms128m -Xmx256m
- -Dcom.sun.jndi.ldap.connect.pool.protocol=\"plain ssl\"
- -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"

These will probably not work:

CATALINA_OPTS="-Xms128m -Xmx256m
- -Dcom.sun.jndi.ldap.connect.pool.protocol='plain ssl'
- -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"
CATALINA_OPTS='-Xms128m -Xmx256m
- -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
- -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'

I suspect that there is some quoting being done in the catalina.sh
script itself which is confusing things. Try looking at the script
itself to see where such quoting is being done, and how you might
"defeat" it :)

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

iEYEARECAAYFAkousdUACgkQ9CaO5/Lv0PA1QQCfT88n8/vMnkbtiC7wnPgQgdVg
438AmwV8lUADAdBfcWd9VeOZYGJqX2Y6
=zRFk
-----END PGP SIGNATURE-----

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


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

Posted by André Warnier <aw...@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"'


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


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

Posted by Bap <ba...@a1.org.uk>.
Hi Chris,

Thanks for the reply.
Unfortunately I had already tried all of those suggestions - and more  
- before posting. I have just retried the three below, to double  
check, but unfortunately all with similar results - either looking to  
run ssl ssl" or ssl'

I am pretty sure that the issue is with the shell, and have been using  
the code below to test all sorts of combinations of values for OPTS -  
the only way I can get the arg to print on one line is to quote $OPTS  
when it is expanded, which obviously will not work if there are any  
other options required in CATALINA_OPTS.

Can anyone provide any more suggestions, or am I going to have to  
modify catalina.sh - I really do not want to do that, for obvious  
reasons.


Again, thanks, in advance, for any help offered,
Bap.




<shell_script>
#!/bin/sh

OPTS='"lkjxdf adf"'

function echo_args() {
         echo $1
         echo $2
}

echo_args $OPTS
</shell_script>



Quoting Christopher Schultz <ch...@christopherschultz.net>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bap,
>
> On 6/9/2009 1:06 PM, Bap wrote:
>> I am trying to set the following system property/value in setenv.sh
>> com.sun.jndi.ldap.connect.pool.protocol="plain ssl"
>
>> If I enclose the whole CATALINA_OPTS in single quotes, then the value
>> looks fine when echoed, but the catalina.out contains Exception in
>> thread "main" java.lang.NoClassDefFoundError: ssl"
>
>> The complete contents of setenv.sh is the single line below.
>> CATALINA_OPTS='-Xms128m -Xmx256m
>> -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
>> -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'
>
> So, the above echos fine but causes the NoClassDefFoundError?
>
> Try any one of the following, which might work:
>
> CATALINA_OPTS="-Xms128m -Xmx256m
> - -Dcom.sun.jndi.ldap.connect.pool.protocol=plain\ ssl
> - -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"
> CATALINA_OPTS='-Xms128m -Xmx256m
> - -Dcom.sun.jndi.ldap.connect.pool.protocol=plain\ ssl
> - -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'
> CATALINA_OPTS="-Xms128m -Xmx256m
> - -Dcom.sun.jndi.ldap.connect.pool.protocol=\"plain ssl\"
> - -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"
>
> These will probably not work:
>
> CATALINA_OPTS="-Xms128m -Xmx256m
> - -Dcom.sun.jndi.ldap.connect.pool.protocol='plain ssl'
> - -Dcom.sun.jndi.ldap.connect.pool.timeout=10000"
> CATALINA_OPTS='-Xms128m -Xmx256m
> - -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl"
> - -Dcom.sun.jndi.ldap.connect.pool.timeout=10000'
>
> I suspect that there is some quoting being done in the catalina.sh
> script itself which is confusing things. Try looking at the script
> itself to see where such quoting is being done, and how you might
> "defeat" it :)
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkousdUACgkQ9CaO5/Lv0PA1QQCfT88n8/vMnkbtiC7wnPgQgdVg
> 438AmwV8lUADAdBfcWd9VeOZYGJqX2Y6
> =zRFk
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


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