2016-04-06 120 views
0

我正在使用Tomcat 7.0.65。訪問Tomcat管理器拋出404

這裏是我的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

失敗, 「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. 

請注意,我正在以/ manager/text訪問URL。即使捲曲失敗,同樣的錯誤。

我是否缺少配置?

回答

0

許多調試後,我找到了真正的原因是ManagerServlet是未能獲得與以下安全異常實例:

java.lang.SecurityException: Restricted (ContainerServlet) class org.apache.catalina.manager.ManagerServlet 

解決的方法是在「上下文設置「特權=真」 「部分在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.