【问题标题】:Can't access Tomcat 6 Manager app无法访问 Tomcat 6 Manager 应用程序
【发布时间】:2012-02-02 08:40:42
【问题描述】:

当我尝试访问以下 URL 时,系统不断提示我输入用户名和密码:

http://localhost:8080/manager/html

应用服务器: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>

我使用以下命令启动 Tomcat:sudo ./startup.sh

我停止了 Tomcat:sudo ./shutdown.sh

【问题讨论】:

  • 您是否尝试过使用用户:tomcat,密码:tomcat 进行日志记录?
  • 你试过 吗?
  • 根据文件 apache-tomcat-6.0.35/webapps/manager/WEB-INF/web.xml,角色 manager-gui 是支持的,所以我也尝试了这个角色,没有成功。我也尝试过 gui-manager,但没有成功。
  • 当你做出这些改变时,你是不是在重新测试 Tomcat?
  • 绝对!我在 osx 中尝试了类似的东西,它在 FF、Chrome 和 Safari 上运行得非常好。要么我错过了一些非常愚蠢的东西,要么我要杀死 Centos。

标签: web-applications tomcat


【解决方案1】:

根据以下文档的链接,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"/>

使用user 和password 登录。

100% 有效。

【讨论】:

    【解决方案2】:

    如果您在设置 tomcat-users.xml 后仍有问题,请检查该文件是否以标准方式从 server.xml 引用。 和 都需要定义。

    我从全新安装的 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>
    

    【讨论】:

      【解决方案3】:

      更新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

      【讨论】:

        【解决方案4】:

        不要忘记检查您的管理应用程序是否存在于 %tomcat_dir%/webapps 中。如果没有,可以用tomcat发行版重新下载

        【讨论】:

          【解决方案5】:

          我昨晚遇到了这个问题,问题(在确保使用正确的 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" />
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-09-15
            • 1970-01-01
            • 2020-09-10
            • 1970-01-01
            • 2017-01-17
            • 2017-12-14
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多