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,重新进行部署即可!(这里我的是先启动 Tomcat 服务,然后才进行部署 mvn tomcat7:deploy

4)取消部署时应先执行 mvn tomcat7:undeploy,再关闭 Tomcat 服务。

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

4、命令部署

命令 描述
tomcat7:run 运行当前项目
tomcat7:deploy 部署当前项目
tomcat7:redeploy 重新部署项目
tomcat7:exec-war 创建一个可执行的jar文件,允许使用java -jar mywebapp.jar 运行web项目
tomcat7:undeploy 取消部署一个war
tomcat7:help 在tomcat7-maven-plugin显示帮助信息


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 maven启动tomcat7:run报错:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:run (default-cli) on project travel: Could not start Tomcat [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-cli) on project test: The packaging for this project did not assign a file to the build artifact -> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-cli) on project kircp-js-plan-resource: The packaging for this project did not assign a file to the bu Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:generate (default-cli) on project : resource does not exist 兼容问题:Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project sms-c [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:create (default-cli) on project standalone-pom: Unable to parse configuration of 3: mojo org.apache.maven.plugins: 【maven】【idea】使用idea的maven进行deploy操作失败,报错:Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project proengine-db-sdk: Failed to deploy artifacts 错误码401 Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.26.v20200117:run (default-cli) on project ssm-mybatis-plus: Failure Java报错:Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.26.v20200117:run (default-cli) on project ssm-mybatis-plus: Failure
 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM