使用maven将war部署到远程Tomcat 8时出现401(未授权)错误 [英] 401 (Unauthorized) error while using maven to deploy war to remote Tomcat 8

查看:1158
本文介绍了使用maven将war部署到远程Tomcat 8时出现401(未授权)错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在远程Tomcat 8上部署战争,但在此过程中收到401(未授权)错误。

I am trying to deploy a war on remote Tomcat 8 but getting 401 (Unauthorized) error in the process.

[ERROR] Tomcat return http status error: 401, Reason Phrase: Unauthorized



为部署执行的命令



Command executed for deployment

mvn tomcat7:redeploy



pom.xml



pom.xml

<properties>
    <integration.tomcat.url>http://gsi-547576:8080/manager/text</integration.tomcat.url>
</properties>

<!-- Deploy to Remote Tomcat -->
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <url>${integration.tomcat.url}</url>
                <server>integration-tomcat</server>
                <path>/${project.artifactId}</path>
            </configuration>
        </plugin>



tomcat-users.xml



tomcat-users.xml

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

请指导。

推荐答案

您需要为integration-tomcat服务器定义凭据;这通常在〜/ .m2 / settings.xml文件中完成:

You need to define the credentials for your "integration-tomcat" server; this is normally done in your ~/.m2/settings.xml file:

<servers>
  <server>
    <id>integration-tomcat</id>
    <username>manager</username>
    <password>manager</password>
  </server>
</servers>

这篇关于使用maven将war部署到远程Tomcat 8时出现401(未授权)错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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