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

时间:2018-09-09 15:27:17

标签: java maven tomcat java-ee intellij-idea

我在Tomcat和Maven中使用Intellij IDEA。运行重新部署时,出现以下错误。我如何解决它?我尝试过查找,似乎没有一个合适的答案。

[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 个答案:

答案 0 :(得分:1)

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

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