【问题标题】:mvn tomcat7:deploy - Cannot invoke Tomcat manager: Broken pipemvn tomcat7:deploy - 无法调用 Tomcat 管理器:管道损坏
【发布时间】:2015-11-20 17:58:34
【问题描述】:

我在尝试将 CLIFF .war 部署到我的 tomcat7 服务器时遇到错误。

[错误] 无法在项目悬崖上执行目标 org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli):无法调用 Tomcat 管理器:连接到 http://localhost:8080 被拒绝:连接被拒绝

OS X 10.10.5 Apache Tomcat/8.0.24 JVM 1.8.0_05-b13

David-Laxers-MacBook-Pro:CLIFF davidlaxer$ mvn -version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T09:37:52-08:00)
Maven home: /Users/davidlaxer/Downloads/apache-maven-3.2.1
Java version: 1.8.0_05, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ 


David-Laxers-MacBook-Pro:CLIFF davidlaxer$ sudo mvn tomcat7:deploy -DskipTests
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] CLIFF
[INFO] common
[INFO] stanford-entity-extractor
[INFO] cliff
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building CLIFF 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) @ CLIFF >>>
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) @ CLIFF <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) @ CLIFF ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building common 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) @ common >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ common ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/common/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ common ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ common ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ common ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) @ common <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) @ common ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building stanford-entity-extractor 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) @ stanford-entity-extractor >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ stanford-entity-extractor ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 23 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ stanford-entity-extractor ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ stanford-entity-extractor ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ stanford-entity-extractor ---
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) @ stanford-entity-extractor <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) @ stanford-entity-extractor ---
[INFO] Skipping non-war project
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building cliff 2.3.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.1:deploy (default-cli) @ cliff >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ cliff ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ cliff ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/davidlaxer/CLIFF/webapp/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ cliff ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ cliff ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-war-plugin:2.2:war (default-war) @ cliff ---
[INFO] Packaging webapp
[INFO] Assembling webapp [cliff] in [/Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/davidlaxer/CLIFF/webapp/src/main/webapp]
[INFO] Webapp assembled in [1345 msecs]
[INFO] Building war: /Users/davidlaxer/CLIFF/webapp/target/cliff-2.3.0.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.1:deploy (default-cli) @ cliff <<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.1:deploy (default-cli) @ cliff ---
[INFO] Deploying war to http://localhost:8080/cliff-2.3.0  
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] CLIFF ............................................. SUCCESS [  1.728 s]
[INFO] common ............................................ SUCCESS [  1.883 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [  0.265 s]
[INFO] cliff ............................................. FAILURE [ 11.384 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.717 s
[INFO] Finished at: 2015-08-26T08:07:32-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Connection to http://localhost:8080 refused: Connection refused -> [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/ConnectException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :cliff

pom.xml:

               <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.1</version>
                        <configuration>
                                <server>CliffTomcatServer</server>
                                <path>/${project.build.finalName}</path>
                        </configuration>
                </plugin>

~/.m2/settings.xml:

   <server>
      <id>CliffTomcatServer</id>
      <username>cliff</username>
      <password>beer</password>
    </server>

/usr/local/apache-tomcat-8.0.24/conftomcat_users.xml:

<tomcat-users>
<role rolename="manager"/>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <user username="cliff" password="beer" roles="manager,manager-gui,manager-script"/>

添加到 pom.xlm:http://localhost:8080/manager/text

[INFO] Deploying war to http://localhost:8080/cliff-2.3.0  
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB   
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2356/127150 KB   
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2052/127150 KB   
[INFO] I/O exception (java.net.SocketException) caught when processing request: Broken pipe
[INFO] Retrying request
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fcliff-2.3.0
2156/127150 KB   
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] CLIFF ............................................. SUCCESS [  1.523 s]
[INFO] common ............................................ SUCCESS [  1.718 s]
[INFO] stanford-entity-extractor ......................... SUCCESS [  0.359 s]
[INFO] cliff ............................................. FAILURE [ 12.664 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.735 s
[INFO] Finished at: 2015-08-26T11:04:23-08:00
[INFO] Final Memory: 12M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli) on project cliff: Cannot invoke Tomcat manager: Broken pipe -> [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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :cliff
David-Laxers-MacBook-Pro:CLIFF davidlaxer$ 

【问题讨论】:

标签: java maven tomcat7


【解决方案1】:

如果您已经在 tomcat 服务器上部署了相同的应用程序,则需要先取消部署它。如果您再次部署它,它可能会给您的连接错误。

【讨论】:

    【解决方案2】:

    如果您运行的是 CentOS,您可能需要安装额外的管理库:

    yum install tomcat-webapps tomcat-admin-webapps
    

    在其他平台上的解决方案可能类似。

    【讨论】:

    • 在 Ubuntu 上,带有管理器 webapp 的额外包称为 tomcat6-admin、tomcat7-admin 等每个 tomcat 版本。
    【解决方案3】:

    你可能需要添加这个

    <configuration>
       ..
       <update>true</update>
       ..
    </configuration>
    

    到你的 pom.xml 文件中运行

    mvn tomcat7:deploy
    

    【讨论】:

    • 这对我很有帮助
    【解决方案4】:

    我在运行 mvn tomcat7:deploy 而不是 mvn tomcat7:redeploy 时遇到此错误。

    【讨论】:

      【解决方案5】:

      您可能应该检查webapps/manager/WEB-INF/web.xml 文件以确保您的.war 文件小于配置的值。

        <max-file-size>152428800</max-file-size>
        <max-request-size>152428800</max-request-size>
      

      看到这个问题:IBM MobileFirst Platform 6.3 Operational Analytics Failed installation for Tomcat

      【讨论】:

        【解决方案6】:

        当我在 ~/.m2/settings.xml 中设置时,它不起作用。于是我在 pom.xml 中设置,像这样:

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>${tomcat7-maven-plugin.version}</version>
            <configuration>
                <url>http://localhost:8080/manager/text</url>
                <server>tomcat</server>
                <username>admin1</username>
                <password>admin1</password>
                <path>/${project.artifactId}</path>
                <update>true</update>
             </configuration>
        </plugin>
        

        并在 $CATALINA_HOME/conf/tomcat-users.xml 文件中,&lt;tomcat-users&gt; 元素中添加如下:

        <role rolename="manager-script"/>
        <role rolename="manager-gui"/>
        <user username="admin" password="admin" roles="manager-gui"/>
        <user username="admin1" password="admin1" roles="manager-script"/>
        

        然后它对我有用。 :)

        【讨论】:

        • 如果您已经部署了 Web 应用程序,则该消息可能并不完全清楚。您还可以将 true 添加到配置中,以允许部署更新您现有的 Web 应用程序。
        【解决方案7】:

        我无法使用 mvn redeploy 快捷方式,因为我合并了将其拆分为几个 mvn 模块的代码。我建议将 .war 文件从 webapp/target 复制到计算机/服务器上的 tomcat webapps 目录。

        【讨论】:

        • 好的。换个角色怎么办?根据马克哈特鲁普的回答?将角色改回原来的角色?
        • 他的建议很好——我不是 tomcat 专家,所以听起来“manager-script”是用于通过管理控制面板上传战争的脚本的正确角色。我将在本地更新我的代码,看看它是否能让我再次上传(但我记得我认为这更像是一个 mvn 库问题)。
        【解决方案8】:

        在 /manager/text 上部署的角色是“manager-script”,Apache Tomcat Manager How-To 表明它不应应用于具有 manager-gui 角色的用户。我使用了一个只有 manager-script 角色而没有其他角色的部署用户,并且可以很好地上传 WAR 文件而没有损坏的管道消息。如果我将 manager-gui 角色添加到我的部署用户,我会收到您遇到的损坏的管道消息。尝试更改您的 tomcat-users.xml 以将 Cliff 的角色限制为单个管理器脚本角色。希望对您有所帮助。

        http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

        【讨论】:

        • 同样的错误:无法在项目悬崖上执行目标 org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:deploy (default-cli):无法调用 Tomcat 管理器:管道损坏
        猜你喜欢
        • 2017-01-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-20
        • 2013-10-10
        • 2010-10-28
        • 2011-03-19
        相关资源
        最近更新 更多