zoukankan      html  css  js  c++  java
  • 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:2018codeXXX>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显示帮助信息
  • 相关阅读:
    Xshell连接virtualbox下的fedora虚拟机
    异常:java.sql.SQLIntegrityConstraintViolationException: Column 'category' cannot be null
    JQuery中获取表中的数据
    关于springboot报错:新建springboot项目报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    IDEA设置
    java基础总结
    JavaWeb----Servler
    IDEA2020版使用
    Java面向对象
    【CMU 6.824】 RPC & Threads
  • 原文地址:https://www.cnblogs.com/wumz/p/9933244.html
Copyright © 2011-2022 走看看