A défaut de se connecter à l'instance Tomcat JMXLa connexion au serveur Tomcat JMX ne
Ok je suis coincé maintenant - Im essayant de configurer JMX avec Tomcat comme suit
$CATALINA_BASE/setenv.sh
:
CATALINA_OPTS="-Dcom.sun.management.jmxremote.port=18070 -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access"
export CATALINA_OPTS
$CATALINA_BASE/conf/jmxremote.password
monitorRole monitorpass
controlRole controlpass
$CATALINA_BASE/conf/jmxremote.access
monitorRole readonly
controlRole readwrite
L'outil client j'utilise pour accéder au serveur JMX Tomcat est en cours d'exécution sur la même machine que l'instance Tomcat. quand je commence tomcat je peux voir qu'il ya quelque chose à l'écoute sur le port 18070 mais lorsque je tente de se connecter je reçois l'erreur suivante
Exception in thread "main" java.lang.SecurityException: Authentication failed! Credentials required
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticationFailure(JMXPluggableAuthenticator.java:193)
at com.sun.jmx.remote.security.JMXPluggableAuthenticator.authenticate(JMXPluggableAuthenticator.java:145)
at sun.management.jmxremote.ConnectorBootstrap$AccessFileCheckerAuthenticator.authenticate(ConnectorBootstrap.java:185)
at javax.management.remote.rmi.RMIServerImpl.doNewClient(RMIServerImpl.java:213)
Je vous connecter en utilisant le bit de code suivant
try {
url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:18070/jmxrmi");
jmxc = JMXConnectorFactory.connect(url,null);
mbsc = jmxc.getMBeanServerConnection();
} catch (MalformedURLException e) {
throw new Exception(methodName + ":" + e);
} catch (IOException e) {
throw new Exception(methodName + ":" + "Failed to connect to the Tomcat Server " + e);
}
Il fonctionne bien si je mets com.sun.management.jmxremote.authenticate = true à false. À part ça, ça échoue. L'outil client s'exécute sur la même machine que l'instance tomcat, donc il ne devrait pas y avoir de problèmes avec le pare-feu. Tous les indices
Oh je ne savais pas que je devais fournir les informations d'identification du côté client. Je pensais que Tomcat les lirait à partir du fichier de mot de passe. Je vais essayer l'exemple ci-dessus merci. – ziggy
Mais c'est la menace - un client qui peut lire et manipuler la VM devrait être autorisé à le faire. – mtraut