2012/12/11 André Warnier <a...@ice-sa.com>:
> Cédric Couralet wrote:
> ...
>
>>
>> One question, though, in the tomcat doc (for 6.0.x) for the
>> JMXRemoteListener, the configuration is :
>>
>>
>> -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
>>
>> -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
>>
>> while mine is
>> -Dcom.sun.management.jmxremote.password.file=${CATALINA_BASE}/conf/jmxremote.password
>> (notice the {} ).
>>
>> is it my mistake?
>>
>>
>
> No, it is not a mistake.  The above are lines extracted from a shell script,
> I presume.
> In this particular case, $CATALINA_BASE and ${CATALINA_BASE} are equivalent.
> The {} form helps to clarify things for the shell when the character which
> *follows* the name of the variable, could be considered by the shell as part
> of the variable name.
> For example in :
>
> echo "something" > $my_file_conf
>
> it is not clear whether the name of the variable is "my" or "my_file" or
> "my_file_conf".
> (or anything in-between), and by default the shell will use the longer
> possibility.
>
> Writing this as
>
> echo "something" > ${my_file}_conf
>
> leaves only one possible interpretation.
>
> In "$CATALINA_BASE/conf/jmxremote.password" there is really no ambiguity
> (because "/" cannot be part of a variable name), but the form
> "${CATALINA_BASE}/conf/jmxremote.password" is anyway clearer and less prone
> to oversights.
> (But it is slightly more work to type, and as programmers are a notoriously
> lazy and hubristic bunch, they rarely go through the trouble).
>
> I suppose that - just to kid Christopher - I could on like this, talking
> about interpolation and stuff, but I'll leave it at that because it's
> already late here.
>

I finally had some times to do some testing.
First even with useLocalPorts=true, the JmxConnectorServer listen on
all interfaces but won't accept connection from remote host. From the
tomcat code, only the rmi client socket is forced to localhost at
least on tomcat 6.0.x. A RMI server Socket could be created to force
listening on a specified interface but I am not sure of any side
effect.

Second, for my password problem, there was a problem with my
configuration. In the tomcat service for JavaOptions, i had
-Dcom.sun.management.jmxremote.authenticate=true (with a space after
true), so when parsing the system properties in the Listener, the
lines (in the init() method):
   String authenticateValue = System.getProperty(
                "com.sun.management.jmxremote.authenticate", "true");
   authenticate = Boolean.parseBoolean(authenticateValue);
returned false.

This is only a problem with tomcat as a service (on windows), in
command line i'm guessing the double space won't be taken into account
by the shell.


And now, another problem with this is that i can't reference
catalina.base in those options. I tried :
%CATALINA_BASE%, $CATALINA_BASE , ${catalina.base} and neither values
are expanded.
Is it possible at all?
It is not so much of a problem, i can write the path by hand, but it
would be nice to have.

Cédric

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

Reply via email to