JConsole command line credentials

2019-02-11 21:39发布

问题:

Is it possible to pass credentials for monitored resource to JConsole while starting it via command line. I've got the command like that right now.

${jdk.home}/bin/jconsole.exe
    -J-Djava.class.path=${jdk.home}/lib/jconsole.jar;
        ${jdk.home}/lib/tools.jar;${weblogic.home}/server/lib/wljmxclient.jar
    -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote
    service:jmx:iiop://127.0.0.1:7510/jndi/weblogic.management.mbeanservers.runtime

Does anyone know if that's possible and where should those credentials be placed.

Thanks.

回答1:

I don't think there is a command line access option to do this. It's a sensible approach since it would reveal credentials in the process signature which might be visible to others.

However, you can specify a password file using the system property com.sun.management.jmxremote.password.file.

These options are documented here.



回答2:

As far as I know, you can't. From your example though it looks like you are only trying to connect locally to a JMX process. In that case you could simply disable authentication in the JMX process (and make sure it listens for JMX only over localhost). Then you don't need to pass credentials and it will work with jconsole. For a true remote connection though (in which you will definitely want authentication, among other things like encryption), I think you have to try out one of the many other jmx type clients.



回答3:

It is not possible with JConsole. The alternative JMX console that enables you to pass username/password from command line is jmxterm.

It can be found here: http://wiki.cyclopsgroup.org/jmxterm