Tomcat-Maven-插件401错误 [英] Tomcat-maven-plugin 401 error

查看:76
本文介绍了Tomcat-Maven-插件401错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习tomcat的基础知识,而当我尝试在tomcat上部署Web应用程序时,出现以下错误

i am learning tomcat basics and while i tried to deploy my web-application on tomcat i am getting the following error

[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project struts2-demoapp: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/html/deploy?path=%2FmkyWebApp&war= -> [Help 1]
[ERROR]

据此看来战争文件的位置没有被传递给tomcat管理器.我在tomcat-user.xml

as per this it seems war file location is not being passed to the tomcat manager.i have the following entries in my tomcat-user.xml

tomcat-users>
<user name="admin" password="admin" roles="admin,manager" /><!--
  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="manager"/>
  <role rolename="admin"/>
  <user username="admin" password="admin" roles="admin,manager"/>


</tomcat-users>

这是pom.xml

<build>
        <plugins>
        <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <configuration>
                <warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
                <url>http://localhost:8080/manager/html</url>
                <server>myserver</server>
                <path>/mkyWebApp</path>

        </configuration>
</plugin>

        </plugins>
    </build>

在我的setting.xml中有条目

in my setting.xml there are the entries

<server>
      <id>Tomcat6.x</id>

      <username>admin</username>
      <password>admin</password>
    </server>

我不确定这里到底出了什么问题.在这方面的任何帮助都会有所帮助.

i am not sure what exactly is going wrong here.any help in this regard will be helpful.

推荐答案

您需要将凭据从settings.xml映射到pom.xml上的服务器配置.

You need to map the credentials from your settings.xml to the server configuration at your pom.xml.

在您的情况下,此操作已完成,但设置了服务器的<id>元素以匹配pom.xml中服务器的主机名.

In your case, this is done but setting the <id> element of your server, to match the server's host name from the pom.xml.

由于您指向的是localhost,因此ID也必须为localhost. 更改主机名时,还必须更新settings.xml.

Since you are pointing localhost, the id must be also localhost. When you change the hostname, you must also update settings.xml.

这篇关于Tomcat-Maven-插件401错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆