java - 为什么我会收到部署错误?

标签 java jakarta-ee tomcat web-applications netbeans

当我尝试从 netbeans 部署我的 Web 应用程序时,出现以下错误:

Starting Tomcat process...
Waiting for Tomcat...
Tomcat server started.
W:\UnderTest\NetbeansCurrent\WebApplication1\nbproject\build-impl.xml:1033: 
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.
BUILD FAILED (total time: 14 seconds)

那是什么?为什么会出现此错误?

以下是 tomcat-users.xml 的片段:

    <tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->

  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager-gui"/>
  <user username="suhail" password="suhail" roles="manager-gui"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>

</tomcat-users>

以下是 netbeans 服务器设置的快照:

enter image description here

最佳答案

您必须添加 manager-script 才能执行部署操作。

所以在你的xml中你应该有类似

的东西
<user username="suhail" password="suhail" roles="manager-gui,manager-script"/>

关于java - 为什么我会收到部署错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16712744/

相关文章:

java - 使用默认值从环境中定义 ant 属性

java - 使用 'contains' 返回两个字符串的比较结果

java - 启动时 hibernate 异常

java - Weblogic12c部署EJB不明确错误

tomcat - 如何使用tomcat强制执行https?

java - hibernate 异常: identifier of an instance of X was altered when trying to merge object

java - 如何使用 Selenium WebDriver 和 Java 拖动 iframe 中的对象

java - Ant 启动目标后

java - 剥离项目后,tomcat 不会从 Eclipse 中启动

java - 具有 SPNEGO SSO 的 Tomcat 6 仍然提示输入登录名和密码