Can't access Manager-app in Tomcat 8

2020-08-01 05:50发布

问题:

I read many similar problems here, but whatever I do, I can't login to manager app. What I have done.

1. I edited the tomcat-users.xml by adding

  <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"/>
  1. I started Tomcat (V.8) with Netbeans
  2. I went to localhost:8084 (netbeans set the port to 8084) and I clicked "manager app".
  3. In the prompted window, I put admin and admin and it doesn't login.

In the properties of the server in Netbeans, there are different credentials. I put the same to both of them (to tomcat-users.xml and there in Netbeans) and still nothing happens.
Every time I make a change, I always restart the Tomcat (no error occurs).

EDIT
When I try to run my application (the default one, when you create a project in Netbeans), I also can't login, so this messages comes up Deployment error: Access to Tomcat server has not been authorized. Set the correct username and password with the "manager-script" role in the Tomcat customizer in the Server Manager. See the server log for details.
However I have added the above in the tomcat-users.xml ...

回答1:

Make sure you're editing the correct file. NetBeans will create it's own copy of the configuration files, so you may have two or more tomcat-users.xml files. In my case on my windows machine, the Tomcat launched by NB uses C:\Users\DevServer\AppData\Roaming\NetBeans\8.0\apache-tomcat-8.0.3.0_base\conf

Also, try simplifying and create a user with just the manager-script role. Then tell NB about that user and pw in the Services/Servers/Connection credentials. Example:

<user username="tomcat_m_script" password="pwhere" roles="manager-script"/>