Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project Resource: Cannot invoke Tomcat manager: Connection refused: connect -> [Help 1]

1、问题描述

在 DOS 下执行 tomcat7-maven-plugin 插件部署,启动 Apache Tomcat 服务报错如下:

D:\2018\code\XXX>mvn tomcat7:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.cqupt.mauger:Resource >----------------------
[INFO] Building Resource 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
...
...
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project Resource: Cannot invoke Tomcat manager: Connection refused: connect -> [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

2、分析原因

出现该问题的主要原因是:apache tomcat 没有找到 JAVA_HOMEJRE_HOME,并且 tomcat 没有配置环境变量,从而导致启服失败!

3、解决方法

1)下载 JDK 并配置环境变量

2)下载 Apache Tomcat 并且配置好环境变量

3)接下来 Clean Maven 工程 Maven —> Update Project,重新进行部署即可!

【JDK 与 Tomcat 环境配置 (这里是 Windows)】

猜你喜欢

转载自www.cnblogs.com/wumz/p/9933244.html
今日推荐