Set the correct username and password with the "manager-script" role in the Tomcat

Viewed 79174

I know this has been asked many before. But I have already placed my user to role "manager-script".

I keep getting this when trying to deploy:

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.

enter image description here

My D:\DEV\apache-tomcat-7.0.47\conf\tomcat-users.xml:

<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
    <role rolename="manager-script"/>
    <user username="user" password="user" roles="manager-script"/>
</tomcat-users>

The server starts just fine without errors from netbeans but when I go to deploy, it keep asking me for the credentials that has "manager-script".

enter image description here

What I have tried:

  1. Removing all other Apache installs/directories.
  2. Rebooting.
  3. Double, triple and quadruple checking the username and password (user@user).

What am I doing wrong?

17 Answers

For those using tomcat 7.0.72 still having the same issue. do the following

  1. after setting users with manager-script in the tomcat-users.xml
<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
  <role rolename="manager-script"/>
  <user username="user" password="user" roles="manager-script"/>
</tomcat-users>
  1. goto C:\Users\[yourname]\AppData\Roaming\NetBeans\8.1 and edit "tomcat70.properties" by adding the following if not included
tomcat.home=C:\\Program Files\\Apache Software Foundation\\Tomcat 7.0
tomcat.url=http://localhost:8080
tomcat.username=manager
tomcat.password=tomcat

Note: change the username and password as above to the username and password you set in the tomcat-users.xml in c:\Program Files\apache...\

  1. Remove the server in Netbeans

  2. Add the tomcat server in Netbeans again and set the username and password as those in tomcat-users.xml

  3. exit both tomcat server and Netbeans

  4. restart your PC and start tomcat server

  5. Run Netbeans as administrator.

These should work.

I added a role like this and Tomcat got successfully started in NetBeans

Remember Run NetBeans as Administrator

<role rolename="manager-script"/>
<user username="admin" password="admin" roles="admin-gui,manager-gui,manager- 
script" />

Very Simple friends.! No need to change that XML file. only go into tools>server>remove server. then add the server again it will ask you to create a username and password. Check the box "create new user if not exist." I tried a minute ago.

If you are doing config with netbeans or any other Java IDE you may face the problem,

For Tomcat9 Goto -> C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf

Edit the "tomcat-users.xml" File

Replace: "<user username="admin" password="admin" roles="manager-gui"/>"

With: "<user username="admin" password="admin" roles="manager-script"/>"

enter image description here

First, you have to go the services and right click on the server properties after that new screen will appear where you have to insert your user name and password

enter image description here

This menu will appear:

enter image description here In the above image you can see the user name and password. After that go to
C:\Users\your_folder\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\tomcat-users.xml where you can see the following details and that must be the same credential as you have input in the Tomcat properties section:

<user password="admin" roles="manager-script,admin" username="admin"/>

The above tag shows the user's credentials.

After that just restart the pc or the user session and it will work.

Related