<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-script,manager-jmx"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>
b.使用jmx对tomcat运行数据进行监控.
在启动的时候加入一下启动参数:
set JAVA_OPTS=-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8998
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
开启jmx服务需要配置jre\lib\management下的jmxremote.access,jmxremote.password文件.将jmxremote.password文件的权限设置仅仅当前用户可读,文档原文为:"The password file should be read-only and only accessible by the operating system user Tomcat is running as."
开启jmx服务之后,可以使用jconsole或者jvisualvm工具对tomcat运行时的jvm数据进行监控.如果开启了jmx的readwrite权限,也可以编写代码对tomcat进行管理,比如停止或者启动web应用.