【问题标题】:How to fix Tomcat HTTP Status 403: Access to the requested resource has been denied?如何修复 Tomcat HTTP 状态 403:访问请求的资源已被拒绝?
【发布时间】:2011-08-14 01:44:18
【问题描述】:

我正在尝试使用我当前的源代码设置 Tomcat。 我从 tomcat 网站 (6.0.32) 下载了 zip。

然后我将我的项目的配置文件放入tomcatDir\conf\Catalina\localhost

然后我将用户添加到tomcat-users.xml

当我使用localhost:8080/<context root> 访问我的应用程序时,我得到了我应该得到的登录提示。提供正确的凭据后,tomcat 会抛出 403 错误。 我可以通过localhost:8080/manager/访问管理器

tomcat-users.xml

<role rolename="manager"/>
<role rolename="admin"/>
<user username="admin" password="5c50nD" roles="admin,manager"/>
<user username="nih\kishorev" password="altum" roles="admin,manager"/>

【问题讨论】:

  • 我也遇到了同样的问题……你解决了吗?我可以访问状态页面,但管理器应用程序给出了这个错误..

标签: tomcat http-status-code-403


【解决方案1】:

您应该选择由 tomcat 定义的经理角色,而不是 admin 或 manager。

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

链接到Configuring Manager Application access in tomcat

【讨论】:

    【解决方案2】:

    需要将表单动作改为Post,显然6.0.32版本的tomcat的GET方法有问题,应该在6.0.33版本的tomcat中修复。

    link to tomcat bugzilla

    【讨论】:

      【解决方案3】:

      这个适合我

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

      【讨论】:

        【解决方案4】:

        我遇到了同样的问题。我需要做两件事。在里面 web.xml 你必须定义 BASIC 或其他导致基于表单的登录提示和角色名称的方法,例如 Admin:

            <security-constraint>   
            <web-resource-collection>   
                <web-resource-name>Protected Admin Area</web-resource-name>   
                <url-pattern>/Admin</url-pattern>   
            </web-resource-collection>
            <auth-constraint>
                <role-name>Admin</role-name>
            </auth-constraint>   
          </security-constraint>  
          <login-config>   
                <auth-method>BASIC</auth-method>
          </login-config>  
        

        在 tomcat-users.xml 中添加一个角色为 Admin 的用户,或者如果您使用像 eclipse 这样的图形界面,请执行以下操作:

        【讨论】:

          【解决方案5】:

          请检查你的 web.xml 里面放的

          &lt;role-name&gt;AllAuthenticatedUser&lt;/role-name&gt; 中的AllAuthenticatedUsers 替换为AllAuthenticatedUsers

          试试这个,让我知道它是否有效。

          【讨论】:

            猜你喜欢
            • 2018-07-19
            • 1970-01-01
            • 1970-01-01
            • 2011-01-31
            • 1970-01-01
            • 1970-01-01
            • 2021-02-10
            • 2017-06-18
            • 1970-01-01
            相关资源
            最近更新 更多