14

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?

Community
  • 1
  • 1
capdragon
  • 14,565
  • 24
  • 107
  • 153
  • 1
    Short answer - don't know. Your tomcat-users.xml looks right. Things to check: 1) Is the Manager app deployed? 2) Has the web.xml used by the Manager (where manager-script is used) been changed? 3) Use JMX to confirm that the users and roles are read correctly. 4) Has the Realm been changed in server.xml? – Mark Thomas Dec 17 '13 at 10:27
  • @MarkThomas Please enter your comment as an answer so I can give you credit. I went through your steps... Manager I think was deploying but I couldnt' authenticate. I decided to place back in the original web.xml and server.xml and try again. It worked. So something that was changed was messing me up. But your Step 2 or 4 fixed it, thanks! – capdragon Dec 17 '13 at 16:08
  • Done as request. Thanks in advance. – Mark Thomas Dec 19 '13 at 00:07
  • 1
    http://stackoverflow.com/questions/17155837/netbeans-7-0-1-access-to-tomcat-server-has-not-been-authorized – sampathlk Mar 06 '14 at 16:25

17 Answers17

15

same problem.. fixéd it by adding:

<tomcat-users> <role rolename="manager-script"/> <user username="user" password="user" roles="manager-script"/> </tomcat-users>

to C:\Program files\apache-tomcat-7.0.47\conf\tomcat-users.xml

and remember to run netbeans as administrator.

  • the "user" in password and username i used the same credentials as in netBeans.. find it by opening services, right click on servers, open properties and you should find the credentials there. – martinweberhansen Sep 28 '15 at 14:05
7

Hello the solution is the below :

  1. remove netbeans and tomcat
  2. remove the cash directory c:\users{youruser}.netbeans\
  3. remove the netbeans folder in : C:\Users{youruser}\AppData\Roaming\netbeans
  4. re-install netbeans and tomcat
  5. add your application i will works

tested !! :D

user3715950
  • 79
  • 1
  • 2
6

Short answer - don't know. Your tomcat-users.xml looks right. Things to check:

  1. Is the Manager app deployed?
  2. Has the web.xml used by the Manager (where manager-script is used) been changed?
  3. Use JMX to confirm that the users and roles are read correctly.
  4. Has the Realm been changed in server.xml?
Qohelet
  • 1,459
  • 4
  • 24
  • 41
Mark Thomas
  • 16,339
  • 1
  • 39
  • 60
4

I also got this error. I've solve with this. I've got this error becasue user I log on to computer is not have permission to get access C: and can't add user info in .\conf\tomcat-users.xml. So I've copy tomcat folders to D: and remove and add again tomcat server in my NetBeans and start server again.. Now I'm fine.

stnaung
  • 41
  • 1
3

Go to C:\Users\ur folder\AppData\Roaming\NetBeans\8.0.2\apache-tomcat-8.0.15.0_base\conf\tomcat-users.xmland delete the line

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

within the tomcat users tab.

remove the apache tomcat server from netbeans and add it again setting catalina home to C:\Program Files\Apache Software Foundation\Apache Tomcat 8.0.15\conf\Catalina\localhost\conf\Catalina\localhost and create a new user. Then it will be fixed

Peter Szekeli
  • 2,712
  • 3
  • 30
  • 44
Noby Nirmal
  • 353
  • 2
  • 5
3

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.

Goyuix
  • 23,614
  • 14
  • 84
  • 128
2

Remember restarting Tomcat apter you follow there guide, no need to to remove netbean and tomcat! Here is my steps:

1- remove the netbeans folder in C:\Users{youruser}\AppData\Roaming\netbeans

2- set permission to tomcat_users.xml

3- edit tomcat_user.xml

4- restart Tomcat

It works!

AnHuy
  • 21
  • 4
0

I know this has been solved but I went through something similar on Windows where my "..\Apache\Tomcat.." was in program files and what worked for me was

1.Exit Netbeans (If open) 2.Run Netbeans as administrator

Hope this helps someone.

Teo
  • 1
  • 2
0

Change your tomcat-users.xml locate at conf directory of Apache installation location then restart the net-beans.

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

or you can remove Apache server from Netbeans and re-add.

0

Just succeeded after several hours of despair. It seems it is caused by netbeans not having privileges to the Program Files folder. Try to use a separate CATALINA BASE folder, where the configuration will reside.

v-tec
  • 586
  • 6
  • 6
0
  1. Uninstall Tomcat
  2. Reinstall tomcat and add manager-script in roles while installing
0

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" />
Z A Abbasi
  • 129
  • 1
  • 8
0

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.

0

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

rdbhandari
  • 71
  • 7
-1

Open xampp control panel. Select Config=>tomcat_users.xml Un-comment this at the end of the file:

     <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
 <user password="space" roles="manager-script,admin" username="root"/>

-1

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.

Jan Schultke
  • 17,446
  • 6
  • 47
  • 96
-2

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