Доступ к диспетчеру Tomcat выбрасывает 404
Я использую 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" />
Я могу получить доступ к указанным ниже URL-адресам: [запрашивает учетные данные в первый раз]
http://localhost:8080/manager/status http://localhost:8080/manager/status/all
Но доступ к любому из URL:
http://localhost:8080/manager/text/sessions?path=/examples http://localhost:8080/manager/text/serverinfo
не удается с "404 не найден". Ниже отображается сообщение об ошибке:
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.
Обратите внимание, что я получаю доступ к URL-адресу как /manager/text . Даже скручивание завершается с той же ошибкой.
Я что-то пропустил?
2 ответа
После долгих отладок я обнаружил, что настоящая причина была в том, что не удалось создать экземпляр ManagerServlet с приведенным ниже исключением безопасности:
java.lang.SecurityException: Restricted (ContainerServlet) class org.apache.catalina.manager.ManagerServlet
Исправить это можно, установив "privileged=true" в разделе "Context" в 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.
Укажите указанные ниже роли в файле conf/tomcat-users.xml.
<user username="test" password="test" roles="admin-gui,manager-gui"/>