401 Unauthorized error while logging in Manager-App of Tomcat

后端 未结 19 2342
谎友^
谎友^ 2020-12-14 07:37

I am trying to log in to the Manager App in Tomcat 7.0.22 for Mac OS X 10.7. Here is the error I am getting: http://f.cl.ly/items/421q1K3f1i0X1H1M181v/so.tiff



        
相关标签:
19条回答
  • 2020-12-14 08:08

    Check your browser.

    I was running tomcat locally on Windows, and trying to log in using Chrome. None of the suggestions above seemed to work. Finally on a whim, I tried Firefox and got the login prompt! I restarted Chrome and tried it again, and still nothing. It appears our network policy screws with Chrome - probably blocking the popup login dialog.

    0 讨论(0)
  • 2020-12-14 08:08

    Check the exact lines in server.xml

      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>
    

    Navdeep

    0 讨论(0)
  • 2020-12-14 08:09

    In my case, I had multiple <Engine><Host>...</Host></Engine> sections in my context.xml and I had to copy and paste the <Realm className="org.apache.catalina.realm.LockOutRealm">...</Realm> into each <Engine>...</Engine> section because I had the manager app deployed in each one of these hosts that were part of a separate Engine.

    The answer from @swapnil chaudhari about the IP address restriction in the app's META-INF/context.xml is also helpful, however I found it more beneficial to override the Context in my server's server.xml.

    In the end, I have something like this for each one of my Engines:

        <Engine name="CatalinaMyUniqueEngine"
                defaultHost="MyUniqueHost">
          <Realm className="org.apache.catalina.realm.LockOutRealm">
            <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                   resourceName="UserDatabase"/>
          </Realm>
          <Host name="MyUniqueHost"
                appBase="/opt/tomcat/webapps/MyUniqueHost"
                unpackWARs="true" autoDeploy="true">
            <Context path="/manager" privileged="true" antiResourceLocking="false"
                     docBase="manager">
              <!-- Wider allowance than the default.
                   Or you can remove to allow all IPs, which probably isn't
                   a good idea. -->
              <Valve className="org.apache.catalina.valves.RemoteAddrValve"
                     allow="127\.0\.0\.1|10\.244\.\d+.\d+" />
          </Host>
        </Engine>
    

    docBase is relative to appBase. In /opt/tomcat/webapps/MyUniqueHost, I have a symbolic link to the manager application installed by my system's package manager (Debian-based), which placed it at /usr/share/tomcat8-admin/manager. These symbolic links allow me to use the manager app in all my Hosts without copying the manager application.

    0 讨论(0)
  • 2020-12-14 08:13

    I had same error then I changed password in users.xml. It solved. If you use some special chars like & or @. It doesn't work. Remove it.

    0 讨论(0)
  • 2020-12-14 08:13

    I tried to add username as tomcat in tomcat-users.xml which was already a role and it was not working. Then I given username as admin for and It worked fine..:)

    0 讨论(0)
  • 2020-12-14 08:14

    OK, I had this error too. Couldn't find the bug, couldn't find the bug, couldn't find the bug. My "tomcat-users" block looked just like this.

    <tomcat-users>
    <role rolename="manager-gui"/>
    <user name="tomcat" password="s3cret" roles="standard,manager-gui"/>
    </tomcat-users>
    

    FINALLY FOUND THE BUG. I kept editing the XML inside the XML comment block:

    <!--
    <tomcat-users>
    <role rolename="manager-gui"/>
    <user name="tomcat" password="s3cret" roles="standard,manager-gui"/>
    </tomcat-users>
    -->
    

    DOH!

    So: don't forget to remove the "<!--" and "-->".

    0 讨论(0)
提交回复
热议问题