无法访问Tomcat 6 Manager应用程序

时间:2012-01-04 12:37:13

标签: web-applications tomcat

当我尝试访问以下网址时,系统会提示我输入用户名和密码:

http://localhost:8080/manager/html

App Server:Tomcat 6.0.35

浏览器:Firefox 3.6.18

操作系统:Centos 5.5

tomcat-users.xml的内容:

<tomcat-users>
    <role rolename="manager"/>
    <user username="tomcat" password="tomcat" roles="manager"/>
</tomcat-users>

我用:sudo ./startup.sh

启动了Tomcat

我用:sudo ./shutdown.sh

停止了Tomcat

5 个答案:

答案 0 :(得分:18)

根据以下文档的链接,Apache Tomcat 6的角色已更改。 http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Configuring_Manager_Application_Access

管理器应用程序定义了四个角色:

manager-gui - Allows access to the html interface
manager-script - Allows access to the plain text interface
manager-jmx - Allows access to the JMX proxy interface
manager-status - Allows access to the read-only status pages

对于您的问题,请尝试以下方法:

<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<user username="user" password="password" roles="admin,manager,manager-gui"/>

使用userpassword登录。

100%工作。

答案 1 :(得分:1)

如果在设置tomcat-users.xml后仍有问题,请检查此文件是否以标准方式从server.xml引用。两者都是&lt; GlobalNamingResources&gt;和&lt; Realm&gt;需要定义。

我从全新安装的Tomcat中提取了以下内容:

<Server port="8005" shutdown="SHUTDOWN">
 :
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>
  :
  <Service name="Catalina">
    :
    <Engine name="Catalina" defaultHost="localhost">
      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      :
    </Engine>
  </Service>
</Server>

答案 2 :(得分:0)

更新Tomcat-HOME / conf / tomcat-users.xml:

<tomcat-users>
<role rolename="manager"/>
<role rolename="standard"/>
<role rolename="tomcat"/>
<role rolename="admin"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="admin" password="password" roles="standard,manager,admin"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

在ubuntu ::

  • 启动tomcat:sh startup.sh
  • 停止tomcat:sh shutdown.sh

答案 3 :(得分:0)

唐&#39;忘记检查%tomcat_dir%/ webapps中是否存在管理应用程序。如果没有,您可以使用tomcat发行版再次下载

答案 4 :(得分:0)

我昨晚遇到了这个问题,问题(在确保用户创建了正确的manager-gui角色后)证明是我试图访问 localhost 并且有一个RemoteAddrValve在Web应用程序上下文文件(manager.xml)中,仅允许通过 127.0.0.1 访问经理Web应用程序。是的,localhost解析为127.0.0.1,但阀门非常精确。

<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1" />