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显示帮助信息

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. Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (dist) on project hadoop-kms: An Ant BuildException has occured

    编译cdh版hadoop2.5.0出现的问题 系统: CentOs66 64位 JDK:1.7 Maven: 3.0.5 Protobuf: libprotoc 2.5.0 编译命令: mvn pac ...

  2. Maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean Failed to delete access_log

    I'm trying to run simple struts project using maven and tomcat. When I'm trying to exucute next goal ...

  3. Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-

    Maven项目报错:Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clea ...

  4. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile

    完整的错误信息: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile ( ...

  5. Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean)

    eclipse在使用maven的tomcat控件编译java程序时,报错 Failed to execute goal org.apache.maven.plugins:maven-clean-plu ...

  6. Maven clean命令不能执行问题Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project

    执行clean tomcat7:run时Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (de ...

  7. Maven项目报错:Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clea

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) ...

  8. maven 编译出错 Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean

    eclipse在使用maven的tomcat控件编译java程序时,报错 Failed to execute goal org.apache.maven.plugins:maven-clean-plu ...

  9. maven install Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang

    maven打包成war时,报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default- ...

随机推荐

  1. Filter 起航 编程式配置 压缩响应 日志过滤器

    [编程式配置]可以用web.xml配置替换 @WebListenerpublic class FilterListenerConfigurator implements ServletContextL ...

  2. git常用命令(转载自用)

    转载自 阮一峰博客: http://www.ruanyifeng.com/blog/2015/12/git-cheat-sheet.html 一个码农博客: http://blog.gitor.org ...

  3. 给tomcat 配置https

    参考以下链接 https://www.cnblogs.com/xiaoliao/p/5778262.html 本人使用环境和版本 tomcat 7.7 阿里云 centos 7还是red hat 浏览 ...

  4. PTA 逆散列问题 (30 分)(贪心)

    题目链接:https://pintia.cn/problem-sets/1107178288721649664/problems/1107178432099737614 题目大意: 给定长度为 N 的 ...

  5. 【Math for ML】线性代数之——向量空间

    I. Groups 在介绍向量空间之前有必要介绍一下什么Group,其定义如下: 注意定义中的\(\bigotimes\)不是乘法,而是一种运算符号的统一标识,可以是乘法也可以是加法等. 此外,如果\ ...

  6. pythonのpygame初体验

    import pygame import sys from pygame.locals import * #初始化pygame pygame.init() size = width,height=60 ...

  7. WPF DataGrid 列显示0,-1(作废、删除)状态,1,2(支出、收入)类型,操作人(在其他表中),如何转换格式。

    操作人,左联,Join on letf //容我补充 状态,类型,类似的转换,在xmlns中引入common   xmlns:com="clr-namespace:XXX.Common&qu ...

  8. glCleatDepth

    opengl里面的深度缓存  在现实生活中,一个实心物体挡在另外一个实心物体的前面, 后面的那个物体有部分会被遮盖掉 那么opengl里面如何模拟这个情况呢? 每个物体的每个像素都有一个深度缓存的值( ...

  9. CF1105E Helping Hiasat

    题目地址:CF1105E Helping Hiasat 首先将问题转化成图论:对每个人建立一个点,将同一次修改后的所有人代表的点两两连一条边,那么最终所求的就是这个图的最大独立集 我们知道最大独立集是 ...

  10. Spring Bean自动检测

    1-自动检测bean 需要用到<context:component-scan> 注意:a) 需要include进来xmlns:context命名空间:base-package指的是我们要扫 ...