Nous avons une application qui s'exécute sur Tomcat. Vous trouverez ci-dessous les informations sur la version Tomcat :

Server version: Apache Tomcat/7.0.96
Server built:   Sep 26 2019 18:42:39 UTC
Server number:  7.0.96.0
OS Name:        Linux
OS Version:     2.6.32-754.25.1.el6.x86_64
Architecture:   amd64
JVM Version:    1.8.0_232-b09
JVM Vendor:     Oracle Corporation

J'essaie d'utiliser jmxproxy pour obtenir des informations de surveillance. Cependant, lorsque j'exécute curl -u 'user:pss' --url http://localhost:8080/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage&key=used, j'obtiens l'erreur suivante :

root@server [user] curl -u 'user:pss' --url  http://localhost:8080/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage&key=used
[1] 18756
[2] 18757
root@server [user] Error - javax.management.RuntimeOperationsException: Exception occurred trying to invoke the getter on the MBean
javax.management.RuntimeOperationsException: Exception occurred trying to invoke the getter on the MBean
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:629)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
        at org.apache.catalina.manager.JMXProxyServlet.getAttribute(JMXProxyServlet.java:131)
        at org.apache.catalina.manager.JMXProxyServlet.doGet(JMXProxyServlet.java:110)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:548)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:317)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Attribute cannot be null
        ... 29 more

Une idée de ce qui me manque ou de la cause profonde ?

Je vous remercie!

1
Sam 13 févr. 2020 à 03:44

1 réponse

Meilleure réponse

J'ai résolu ce problème en plaçant l'URL entre "". La commande suivante fonctionne donc parfaitement.

$curl -u 'user:pss' --url "http://localhost:8080/manager/jmxproxy/?get=java.lang:type=Memory&att=HeapMemoryUsage&key=used"

1
Sam 12 mars 2020 à 19:16