401 Unauthorized error while logging in Manager-App of Tomcat

后端 未结 19 2340
谎友^
谎友^ 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:17

    Also make sure that you have set TOMCAT_HOME as well as JAVA_HOME environment variables correctly.

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

    If you are at Tomcat 8, you maybe missing the following. After updating the Realms and tomcat-users.xml, you also need to edit the apps' context.xml.

    By default, newer versions of Tomcat restrict access to the Manager and Host Manager apps to connections coming from the server itself. Since we are installing on a remote machine, you will probably want to remove or alter this restriction. To change the IP address restrictions on these, open the appropriate context.xml files.

    For Manager app:

    /webapps/manager/META-INF/context.xml
    

    For Host-Manager app:

    /opt/tomcat/webapps/host-manager/META-INF/context.xml
    

    Comment out the following section for Valve as follows-

    <Context antiResourceLocking="false" privileged="true" >
        <!--<Valve className="org.apache.catalina.valves.RemoteAddrValve"
                allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />-->
    </Context>
    

    You should be allset after this.

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

    The below should work for a "vanilla" installation (or zip/tar archive) - replace your tomcat-users.xml with (similar to) this:

    <?xml version="1.0" encoding="UTF-8"?>
    <tomcat-users>  
      <role rolename="manager-gui"/>
      <role rolename="manager-script"/>
      <role rolename="manager-jmx"/>
      <role rolename="manager-status"/>
      <role rolename="admin-gui"/>
      <role rolename="admin-script"/>
      <user username="abc" password="xyz" roles="manager-gui, manager-script, manager-jmx, manager-status, admin-gui, admin-script"/>
    </tomcat-users>
    

    I ran into similar issue and still not able to login using Google Chrome (Version 73.0.3683.103) as on date 05/14/2019 10:30am CST despite reinstalling/configuring Google Chrome multiple times.

    I would suggest, try using different browser such as Firefox/IE etc if you are running into this issue even after fiddling a lot with xmls.

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

    To add some clarity, here are the roles you need to add to your conf/tomcat-users.xml as of Tomcat 7.x. If you want to keep the comments you can, but this is all you need (to log in with admin/admin) in the file:

    <?xml version="1.0" encoding="UTF-8"?>
    <tomcat-users>  
      <role rolename="manager-gui"/>
      <role rolename="manager-script"/>
      <role rolename="manager-jmx"/>
      <role rolename="manager-status"/>
      <role rolename="admin-gui"/>
      <role rolename="admin-script"/>
      <user username="admin" password="admin" roles="manager-gui, manager-script, manager-jmx, manager-status, admin-gui, admin-script"/>
    </tomcat-users>
    
    0 讨论(0)
  • 2020-12-14 08:25

    In windows I had a CATALINA_HOME environment variable defined for another tomcat installation so that was stating even though I was using the startup script in the new installation folder. So just deleting CATALINA_HOME solved the problem for me.

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

    I also encountered this problem. The content of my tomcat-users.xml was correct, but the file was not readable by Tomcat. I changed the file's group to tomcat7, restarted Tomcat, and voilà!

    Here's the content of my tomcat-users.xml:

    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
      <user username="admin" password="admin" roles="manager-gui, admin-gui" />
    </tomcat-users>
    
    0 讨论(0)
提交回复
热议问题