16

I have used glassfish server in netbeans, now I changed to tomcat and when I run my web application that I have created in glassfish gives me the error :

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.

I have added a role with name "manager-script" in conf/tomcat-user.xml but where is my Server Manager? I did'nt find it. Please help me.
thanks...

vbence
  • 20,084
  • 9
  • 69
  • 118
Deb J
  • 471
  • 2
  • 5
  • 13
  • no, I did'nt. Can you explain a little that what should I change in server.xml. – Deb J Apr 20 '12 at 07:06
  • comment this block : – Satya Apr 20 '12 at 07:08
  • Thanks for your answer, but I already have that code in my conf/server.xml file.What shoud I do now? – Deb J Apr 20 '12 at 08:30
  • 1
    Check the tomcat-users.xml of the "Catalina Base" directory. Right-click Apache Tomcat 6.xx (under Servers) and look for the connection tab. There should be a path called Catalina Base. Browse to it and note the credentials set; default is username: ide and password: tomcat-users. Including: Make sure you set the same credentials in that Servers dialog. Close it and you are ready to ryme! Hope this helps! – Satya Apr 20 '12 at 08:39
  • cool ! glad that I could be of any help – Satya Apr 20 '12 at 09:38

8 Answers8

23
  1. Add below lines in tomcat-users.xml.

     <user username="admin" password="password" roles="tomcat,role1,manager-script,manager-gui"/
    
  2. Restart tomcat/service.

fiberair
  • 641
  • 7
  • 17
3

In Ubuntu with Tomcat 7 and Netbeans 7:

Follow @Satya instructions:

Check the tomcat-users.xml of the "Catalina Base" directory. (Right-click Apache Tomcat 7.xx (under Servers) and look for the connection tab).

Then you should make sure that your tomcat-users.xml has something like this:

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

(if you want to be REALLY sure, although it is NOT RECOMMENDED, you can put in roles="manager-script,manager-gui,manager-status,manager-jmx")

Additionally, you can look for the file build-impl.xml under nbproject folder and go to line:

<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>

Change debugmode from "false" to "true". This will allow you to see the errors in Netbeans directly.

Finally, I had to add read permissions tomcat-users.xml for tomcat7 ** (it seems that when editing as root the permissions changed) and in the **logs folder of tomcat, add permissions to the user that runs Netbeans (usually your user). I did it creating a "development" group and added my user and tomcat7 to that group, then I changed the group of the logs giving reading permissions.

Last tip: start Tomcat doing right-click in the Servers section in Netbeans instead of running /etc/init.d/tomcat7 start. That way you will see the logs in the Netbeans console.

Christian Vielma
  • 15,263
  • 12
  • 53
  • 60
3

Remove your existing registered server instance in netbeans and register a new server instance with a user. Steps:

  1. Remove your existing tomcat server instance in from Services ->Servers
  2. Then right click on Servers and click Add Server
  3. Create a new server instance with a user
hirantha129
  • 559
  • 1
  • 8
  • 19
2

NB will try to connect to the Tomcat instance through the proxy if one is specified in IDE settings (Tools|Options|General tab).

So, if you still get this after making the relevant modifications in tomcat-users.xml, check your proxy configuration. Try setting the proxy settings to "No proxy" and then try again. If it works, you have bad proxy settings. "localhost" must be in the "No Proxy Hosts" list. Correct accordingly.

0

If you are going to run you web but it shows the above error , then it is due to no user information in tomcat_user.xml file(C:\apache-tomcat-7.0.33\conf ), so go there open this file and just write this sentence in the end of the " ...."

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

like

<tomcat-users>
   .
   .
   .
<user password="123" roles="manager-script,admin" username="pir fahim" /> ///write this at this place in the file
</tomcat-users>

now copy the above sentence and paste it in your file just change your name and password, no changes with roles

Pir Fahim Shah
  • 10,505
  • 1
  • 82
  • 81
0

I really should make this a comment if have enough reputation:

PLEASE the first comment by @Satya advicing to remove should be ignored (at least on windows - which am sure of). check this if don't believe me

After many hours on SO I resolved the issue by:

  1. Making sure IDE and text editors (notepad++) are launched with Admin rights
  2. Edit the %TOMCAT INSTALL DIR%\conf\tomcat-users.xml as directed in earlier answers especially this one on a duplicated question and this too
  3. Check that xml file again, I mean properly for syntax errors. Use a good editor for xml, notepad++ help me figured out my error. Thanks to this SO answer

  4. Save the file and start Tomcat

Community
  • 1
  • 1
saheedmyself
  • 7
  • 1
  • 6
0

check the proxy settings under tools > options in the ide.

selecting no proxy resolved this issue for me.

0

Complementing the other answers - I was adding the user line i.e.

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

as people said, but I what I was missing was to simply restart tomcat after that.

Don't forget to restart tomcart service or the changes won't take effect.

Victor Oliveira
  • 3,293
  • 7
  • 47
  • 77