我正在使用Tomcat 7.0.65。
这是我的tomcat-users.xml:
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-status"/>
<user username="admin" password="tomcat" roles="manager,manager-gui,manager-script,manager-status"/>
这是server.xml中的服务器领域片段
<Realm className="org.apache.catalina.realm.MemoryRealm" />
我可以访问以下网址:[它首次要求提供凭据]
http://localhost:8080/manager/status http://localhost:8080/manager/status/all
但访问任何网址:
http://localhost:8080/manager/text/sessions?path=/examples http://localhost:8080/manager/text/serverinfo
未通过&#34; 404未找到&#34;。以下是显示的错误消息:
The page you tried to access (/manager/text/sessions) does not exist.
The Manager application has been re-structured for Tomcat 7 onwards and some of URLs have changed. All URLs used to access the Manager application should now start with one of the following options:
/manager/html for the HTML GUI
/manager/text for the text interface
/manager/jmxproxy for the JMX proxy
/manager/status for the status pages
Note that the URL for the text interface has changed from "/manager" to "/manager/text".
You probably need to adjust the URL you are using to access the Manager application. However, there is always a chance you have found a bug in the Manager application. If you are sure you have found a bug, and that the bug has not already been reported, please report it to the Apache Tomcat team.
请注意,我正在访问网址为/ manager / text。即使卷曲失败也会出现同样的错误。
我错过了任何配置吗?
答案 0 :(得分:1)
经过大量调试后,我发现真正的原因是ManagerServlet未能通过以下安全性异常进行实例化:
java.lang.SecurityException: Restricted (ContainerServlet) class org.apache.catalina.manager.ManagerServlet
解决方法是设置&#34; privileged = true&#34;在&#34;上下文&#34; TOMCAT_INSTALL_DIR / conf / context.xml
中的部分<!-- The contents of this file will be loaded for each web application -->
<Context privileged="true">
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded.
答案 1 :(得分:0)
在 conf/tomcat-users.xml 文件中提供以下角色。
<user username="test" password="test" roles="admin-gui,manager-gui"/>