Ho bisogno di avviare a livello di codice un nuovo processo java e impostare dinamicamente la porta JMX. Così, invece di fare questoÈ possibile abilitare il monitoraggio remoto di jmx a livello di programmazione?
-Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=9995 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
vorrei fare quanto segue
System.setProperty("java.rmi.server.hostname", "127.0.0.1");
System.setProperty("com.sun.management.jmxremote", "true");
System.setProperty("com.sun.management.jmxremote.authenticate", "false");
System.setProperty("com.sun.management.jmxremote.ssl", "false");
System.setProperty("com.sun.management.jmxremote.port", "9995" );
ma non funziona. Qualche idea del perché?
IMHO non è possibile. – SMA
Vedere questo [risposta] (http://stackoverflow.com/questions/7276881/how-to-set-jmx-remote-port-system-environment-parameters-through-java-code-for-r). Puoi ancora monitorare da remoto la JVM usando [Java Attach API] (http://docs.oracle.com/javase/7/docs/technotes/guides/attach/index.html) se questo è il tuo obiettivo. – vsnyc