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_HOME
和 JRE_HOME
,并且 tomcat 没有配置环境变量,从而导致启服失败!