在NetbeansIDE 6.0中运行jsp时出现部署错误

时间:2011-05-14 17:52:21

标签: jsp tomcat netbeans

Deployment error:
Access to Tomcat server has not been authorized. Set the correct username and password with the "manager" 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:163)
        at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: java.lang.IllegalStateException: Access to Tomcat server has not been authorized. Set the correct username and password with the "manager" role in the Tomcat customizer in the Server Manager.
        at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:390)
        at org.netbeans.modules.tomcat5.TomcatManager.modules(TomcatManager.java:623)
        at org.netbeans.modules.tomcat5.TomcatManager.getAvailableModules(TomcatManager.java:434)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.getAvailableTMIDsMap(TargetServer.java:319)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:275)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:224)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.checkUndeployForSharedReferences(TargetServer.java:221)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.processLastTargetModules(TargetServer.java:343)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.init(TargetServer.java:131)
        at org.netbeans.modules.j2ee.deployment.impl.TargetServer.deploy(TargetServer.java:468)
        at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:148)
        ... 16 more
Caused by: org.netbeans.modules.tomcat5.AuthorizationException
        at org.netbeans.modules.tomcat5.TomcatManagerImpl.list(TomcatManagerImpl.java:391)
        ... 26 more
BUILD FAILED (total time: 20 seconds)

3 个答案:

答案 0 :(得分:1)

编辑/conf/tomcat-users.xml并添加角色管理器,其中包含您选择的用户名管理器和密码(manager,tomcat或其他)。

如果Eclipse要求您输入要部署的管理员用户名和密码,那么一旦设置完毕,请务必输入。

答案 1 :(得分:1)

检查“Catalina Base”目录的tomcat-users.xml。 右键单击Apache Tomcat 6.xx(在“服务器”下),然后查找连接选项卡。 应该有一条名为Catalina Base的路径。浏览到它并记下凭据集; default是用户名:ide和密码:tomcat-users。 包含:

确保在“服务器”对话框中设置相同的凭据。关闭它,你准备好了ryme!

希望这有帮助!

答案 2 :(得分:0)

我更改了/conf/tomcat-users.xml

的同一服务器错误

第1步:

更改tomcat-users.xml

<tomcat-users>
<role rolename="tomcat"/>
    <role rolename="role1"/>
    <role rolename="manager-gui"/>
    <user password="tomcat" roles="tomcat,manager-gui" username="tomcat"/>
    <user password="tomcat" roles="tomcat,role1" username="both"/>
    <user password="tomcat" roles="role1" username="role1"/>
    <user password="pass" roles="manager-script,admin" username="me"/>
</tomcat-users>

我添加了两个角色manager-script和admin。

您可以在Configure Manager

找到角色的进一步参考

第2步:

添加角色后,步骤2将把这些凭据添加到Netbeans服务器配置中。

  1. 转到窗口 - &gt;服务
  2. 选择服务器。
  3. 选择您的tomcat,然后右键单击以查看属性。

    现在选择连接选项卡。输入“username”作为me,输入“password”作为pass,如下所示。

    enter image description here