miércoles, 10 de agosto de 2016

Corregir 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

Si al intentar correr tu proyecto en Netbeans en un servidor Tomcat te da el siguiente 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.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:245)
at org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:178)
at org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:130)
at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:212)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.lang.IllegalStateException: 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.
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:398)
at org.netbeans.modules.tomcat5.TomcatManager.modules(TomcatManager.java:639)
at org.netbeans.modules.tomcat5.TomcatManager.getAvailableModules(TomcatManager.java:450)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.getAvailableTMIDsMap(TargetServer.java:420)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:375)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:324)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:321)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.processLastTargetModules(TargetServer.java:442)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:172)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.deploy(TargetServer.java:606)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:197)
... 4 more
Caused by: org.netbeans.modules.tomcat5.AuthorizationException
at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:399)
... 14 more




LA SOLUCIÓN ES:
Añadir el rol manager-script al usuario de tomcat que está asociando al servidor que tienes configurado en tu proyecto. Para ello abre  

nano /etc/tomcat7/tomcat-users.xml

y agrega el rol manager-script al usuario. El mio quedó algo así:



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


Luego reinicias tomcat con service tomcat7 restart y listo

3 comentarios: