Search code examples
javatomcatauthenticationunauthorized

I'm not able to log in Tomcat Manager App


I have read a lot of topics in stackoverflow for solve my problem, but none was useful.

When I tried to log in Manager App ([http://localhost:8080/manager/html][1]) using a lot of different configurations, but I always obtained 401 Unauthorized after attempted to log in using the rights credentials. I restarted the tomcat server a couple of times.

This is my last configuration in conf/tomcat-users.xml

<?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>

This is the part related to tomcat-users in server.xml

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

This is my configuration: Apache Tomcat: Version 7.0.40 64 bit Tested on Chrome 26

If there is something else useful that I forgot, let me know. Thanks in advance


Solution

  • From tailing [tomcat-root]/logs/catalina.out, I observed that you are using a locked username "admin"

    06-May-2014 16:47:41.828 WARNING [http-nio-192.168.0.51-8080-exec-6] org.apache.catalina.realm.LockOutRealm.authenticate An attempt was made to authenticate the locked user "admin"
    

    You should try with a better(non guessable) username.

    <role rolename="manager-gui"/>
    <user username="TomcatAdmin" password="secpa55wd" roles="manager-gui"/>
    

    This should definitely work for you.