Tomcat返回http状态错误:401,原因短语:未经授权[重复]

时间:2022-07-11 08:17:18

This question already has an answer here:

这个问题在这里已有答案:

I am using Intellij IDEA with Tomcat and Maven. When I run redeploy, I get this following error. How do I fix it? I tried looking this up, none of the answers seem to fit.

我正在使用Intellij IDEA与Tomcat和Maven。当我运行重新部署时,我得到以下错误。我如何解决它?我试着看一下,没有一个答案似乎合适。

[ERROR] Tomcat return http status error: 401, Reason Phrase: Unauthorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.498 s
[INFO] Finished at: 2018-09-09T11:23:27-04:00
[INFO] Final Memory: 15M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:redeploy (default-cli) on project SimpleWeb: Tomcat return http status error: 401, Reason Phrase: Unauthorized: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
[ERROR] <HTML><HEAD>
[ERROR] <TITLE>401 Unauthorized</TITLE>
[ERROR] </HEAD><BODY><H1>Unauthorized</H1>
[ERROR] </BODY></HTML>
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

1 个解决方案

#1


1  

Try to define the credentials of your tomcat in the .m2/settings.xml or conf/senttings.xml of your maven

尝试在maven的.m2 / settings.xml或conf / senttings.xml中定义tomcat的凭据

<server>
        <id>TomcatSever</id>
        <username>admin</username>
        <password>admin</password> 
</server>

#1


1  

Try to define the credentials of your tomcat in the .m2/settings.xml or conf/senttings.xml of your maven

尝试在maven的.m2 / settings.xml或conf / senttings.xml中定义tomcat的凭据

<server>
        <id>TomcatSever</id>
        <username>admin</username>
        <password>admin</password> 
</server>