給JVM配置jmx agent

來源:互聯網
上載者:User

工作中需要給tomcat配置jmx來管理MBean。 碰到的問題比較多,記錄下來以便查閱。(慢慢補充)


配置

  給jvm的添加下列參數(有關jmx參數的詳細說明可以參考JAVAM_HOME\jre\lib\management\management.properties檔案)

-Dcom.sun.management.jmxremote.port=1099 
-Dcom.sun.management.jmxremote.local.only=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access



問題

1.關於 Error: Password file read access must be restricted:的問題需要給檔案配置相關許可權

Assigning correct permissions:

chmod 600 /etc/tomcat6/jmxremote.accesschmod 600 /etc/tomcat6/jmxremote.password  (must set 600)chown tomcat6:tomcat6 /etc/tomcat6/jmxremote.accesschown tomcat6:tomcat6 /etc/tomcat6/jmxremote.password


參考資料(但願不要失效)
http://docs.oracle.com/javase/1.5.0/docs/guide/management/agent.html (配置方法)
http://docs.oracle.com/javase/1.5.0/docs/guide/management/security-windows.html (windows下解決 access must be restricted 的問題)
 
---------------------------------------------------------------------------------------------
上面這個方法貌似比較麻煩,需要設定檔案的許可權。 其實還有個比較簡單的方法。對於tomcat來說,可以在server標籤下添加個listener
 
  <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"          rmiRegistryPortPlatform="1099" rmiServerPortPlatform="-1" address="${tomcat.bind.address}" />
 
 
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.