Программисты JAVA общаются здесь
Anonymous
Как подключить VisualVM через ssh к jmx, начатому с помощью `Jcmd ManagementAgent.start`
Сообщение
Anonymous » 27 ноя 2024, 15:26
Я пытаюсь подключить VisualVM к работающему Java-процессу, запущенному без флагов JMX (у меня нет контроля над сценарием запуска). Для этого я включил jmx с помощью jcmd:
Код: Выделить всё
~> jcmd 15868 ManagementAgent.start jmxremote.port=45678 jmxremote.host=127.0.0.1 jmxremote.authenticate=false jmxremote.ssl=false jmxremote.rmi.port=45678
~> jcmd 15868 ManagementAgent.status
15868:
Agent: enabled
Connection Type: local
Protocol : rmi
Host : 127.0.0.1
URL : service:jmx:rmi://127.0.0.1/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5ybWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc3AAtVbmljYXN0UmVmMgAADDE5Mi4xNjguMC4yMwAAr09xSTzUAt4Xp2VIWiAAAAGTZAPJAYBBAHg=
Properties :
com.sun.management.jmxremote.rmi.port = 45678
com.sun.management.jmxremote.host = 127.0.0.1
com.sun.management.jmxremote.authenticate = false
com.sun.management.jmxremote.ssl.need.client.auth = false [default]
com.sun.management.jmxremote.ssl = false
com.sun.management.jmxremote.registry.ssl = false [default]
com.sun.management.jmxremote.local.only = true [default]
com.sun.management.jmxremote.password.file = jmxremote.password [default]
com.sun.management.jmxremote.access.file = jmxremote.access [default]
com.sun.management.config.file = management.properties [default]
com.sun.management.jmxremote.port = 45678
Connection Type: remote
Protocol : rmi
Host : 127.0.0.1
URL : service:jmx:rmi://127.0.0.1:/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5ybWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc3AAtVbmljYXN0UmVmMgAADDE5Mi4xNjguMC4yMwAAsm7Lu/nHDfBys2VIWiAAAAGTZAPJAYBDAHg=
Properties :
com.sun.management.jmxremote.rmi.port = 45678
com.sun.management.jmxremote.host = 127.0.0.1
com.sun.management.jmxremote.authenticate = false
com.sun.management.jmxremote.ssl.need.client.auth = false [default]
com.sun.management.jmxremote.ssl = false
com.sun.management.jmxremote.registry.ssl = false [default]
com.sun.management.jmxremote.local.only = true [default]
com.sun.management.jmxremote.password.file = jmxremote.password [default]
com.sun.management.jmxremote.access
но я не могу найти способ заставить jmxremote.local.only принимать значение false
После открытия ssh-туннель с:
При запуске VisualVM (версия 2.1.10) с VisualVM --openjmx localhost:45678
Я всегда получаю:
Код: Выделить всё
Caused: java.rmi.ConnectException: Connection refused to host: 192.168.0.23; nested exception is:
java.net.ConnectException: Connection refused
Как открыть JMX через JCMD для удаленного доступа?
Подробнее здесь:
https://stackoverflow.com/questions/792 ... gent-start
1732710378
Anonymous
Я пытаюсь подключить VisualVM к работающему Java-процессу, запущенному без флагов JMX (у меня нет контроля над сценарием запуска). Для этого я включил jmx с помощью jcmd: [code]~> jcmd 15868 ManagementAgent.start jmxremote.port=45678 jmxremote.host=127.0.0.1 jmxremote.authenticate=false jmxremote.ssl=false jmxremote.rmi.port=45678 ~> jcmd 15868 ManagementAgent.status 15868: Agent: enabled Connection Type: local Protocol : rmi Host : 127.0.0.1 URL : service:jmx:rmi://127.0.0.1/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5ybWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc3AAtVbmljYXN0UmVmMgAADDE5Mi4xNjguMC4yMwAAr09xSTzUAt4Xp2VIWiAAAAGTZAPJAYBBAHg= Properties : com.sun.management.jmxremote.rmi.port = 45678 com.sun.management.jmxremote.host = 127.0.0.1 com.sun.management.jmxremote.authenticate = false com.sun.management.jmxremote.ssl.need.client.auth = false [default] com.sun.management.jmxremote.ssl = false com.sun.management.jmxremote.registry.ssl = false [default] com.sun.management.jmxremote.local.only = true [default] com.sun.management.jmxremote.password.file = jmxremote.password [default] com.sun.management.jmxremote.access.file = jmxremote.access [default] com.sun.management.config.file = management.properties [default] com.sun.management.jmxremote.port = 45678 Connection Type: remote Protocol : rmi Host : 127.0.0.1 URL : service:jmx:rmi://127.0.0.1:/stub/rO0ABXNyAC5qYXZheC5tYW5hZ2VtZW50LnJlbW90ZS5ybWkuUk1JU2VydmVySW1wbF9TdHViAAAAAAAAAAICAAB4cgAaamF2YS5ybWkuc2VydmVyLlJlbW90ZVN0dWLp/tzJi+FlGgIAAHhyABxqYXZhLnJtaS5zZXJ2ZXIuUmVtb3RlT2JqZWN002G0kQxhMx4DAAB4cHc3AAtVbmljYXN0UmVmMgAADDE5Mi4xNjguMC4yMwAAsm7Lu/nHDfBys2VIWiAAAAGTZAPJAYBDAHg= Properties : com.sun.management.jmxremote.rmi.port = 45678 com.sun.management.jmxremote.host = 127.0.0.1 com.sun.management.jmxremote.authenticate = false com.sun.management.jmxremote.ssl.need.client.auth = false [default] com.sun.management.jmxremote.ssl = false com.sun.management.jmxremote.registry.ssl = false [default] com.sun.management.jmxremote.local.only = true [default] com.sun.management.jmxremote.password.file = jmxremote.password [default] com.sun.management.jmxremote.access [/code] но я не могу найти способ заставить jmxremote.local.only принимать значение false После открытия ssh-туннель с: [code]ssh HOSTNAME -L 45678:localhost:45678[/code] При запуске VisualVM (версия 2.1.10) с VisualVM --openjmx localhost:45678 Я всегда получаю: [code]Caused: java.rmi.ConnectException: Connection refused to host: 192.168.0.23; nested exception is: java.net.ConnectException: Connection refused [/code] Как открыть JMX через JCMD для удаленного доступа? Подробнее здесь: [url]https://stackoverflow.com/questions/79230257/how-to-connect-visualvm-over-ssh-to-jmx-started-with-jcmd-managementagent-start[/url]