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. sql插入oracle链接的数据

    报错OLE DB 访问接口 "OraOLEDB.Oracle" 返回了消息 "ORA-29275: 部分多字节字符". select addr from tes ...

  2. C++ 窗口

    DestroyWindow();     //销毁窗口 可重载的事件: PostNcDestroy    窗口销毁后调用

  3. 线段树模板(hdu1166)

    #include <set> #include <map> #include <queue> #include <stack> #include < ...

  4. python后端将svc文件数据读入数据库具体实现

    如何用python将svc文件的数据读入到MySQL数据库里,在此直接上代码了,感兴趣的朋友可以贴代码测试: import pandas as pd import os from sqlalchemy ...

  5. Mybatis(二)入门程序-通过id查找用户、模糊查找用户、添加用户、删除用户

    根据下图myBatis的架构,创建一个使用MyBatis的工程.       一.配置MyBatis 环境(如图) 1.sqlMapConfig.xml 首先,导入jar包(上图右边)并加载路径,然后 ...

  6. PHP载入GIF图像造成服务器宕机(CVE-2018-5711)的漏洞复现

    参考链接: http://www.freebuf.com/vuls/161262.html 今日看新漏洞发现一个UC编辑部的标题,CVE-2018-5711:一张GIF图片就能让服务器宕机的PHP漏洞 ...

  7. Battery historian安装及使用

    在介绍Battery historian之前首先来介绍一下 Android adb bugreport 工具,bugreport是什么,怎么用? android系统想要成为一个功能完备,生态繁荣的操作 ...

  8. 用css解决table文字溢出控制td显示字数

    场景: 最左边这栏我不行让他换行,怎么办呢? 下面是解决办法: table{ width:100px; table-layout:fixed;/* 只有定义了表格的布局算法为fixed,下面td的定义 ...

  9. SharePoint 2010 安装错误:请重新启动计算机,然后运行安装程序以继续

    一.环境:Windows Server 2008 R2 with sp1,SharePoint 2010 二.问题描述: 正常的安装SharePoint 2010 ,安装完必备组件,并提示所有必备组件 ...

  10. 洛谷 P4948 拉格朗日多项式插值(杜老师板子)

    https://www.luogu.org/problemnew/show/P4948 这篇博客主要目的是存一下的dls的神奇板子,本来应该是推公式或者二分做的 但是dls的插值板子直接写好了这个特殊 ...