Skip to content

Instantly share code, notes, and snippets.

@ezhov-da
Last active December 12, 2020 19:20
Show Gist options
  • Save ezhov-da/676fc7ca6e7a0f1a887e6078bf2a2011 to your computer and use it in GitHub Desktop.
Save ezhov-da/676fc7ca6e7a0f1a887e6078bf2a2011 to your computer and use it in GitHub Desktop.
Mbean
https://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html
Для того, чтоб подключаться к приложению через JConsole, необходимо:
1. Описать интерфейс
2. Реализовать
3. Запустить приложение с параметрами:
-Dcom.sun.management.jmxremote.port=9005
-Djava.rmi.server.hostname=localhost
ServerMBean ws = new Server(textPane);
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
server.registerMBean(ws, new ObjectName("test_server:type=server,name=Port 9005"));
https://habrahabr.ru/post/147008/">https://habrahabr.ru/post/147008/
Для того, чтоб к приложению могли подключаться удаленно необходимо запускать его со следующими параметрами:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=10101
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=ip-address --необязательный параметр
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment