代码之家  ›  专栏  ›  技术社区  ›  Muhammad Wahaj

Tomcat7 maven插件-处理请求时捕获的I/O异常(java.net.SocketException):管道断裂

  •  1
  • Muhammad Wahaj  · 技术社区  · 7 年前

    我一直在尝试使用mvn tomcat7:deploy命令部署我的WAR文件,但我遇到了管道中断错误。我正在使用Ubuntu。以下是所需的文件。

    这是POM。xml

      <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                        <url>http://localhost:8080/manager/text</url>
                        <server>TomcatServer</server>
                        <path>/helloworld</path>
                </configuration>
            </plugin>
        </plugins>
    

    我的/配置/设置。tomcat的xml具有

    <server>
        <id>TomcatServer</id>
        <username>maven</username>
        <password>maven</password>
    

    和tomcatusers。xml如下所示

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

    使用以下命令部署时

    mvn tomcat7:部署

    我收到这些错误

    > Uploading: http://localhost:8080/manager/text/deploy?path=%2Fhelloworld
    120/23235 KB
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: I/O exception (java.net.SocketException) caught when processing request: Connection reset
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: Retrying request
    Uploading: http://localhost:8080/manager/text/deploy?path=%2Fhelloworld
    2/23235 KB
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: I/O exception (java.net.SocketException) caught when processing request: Broken pipe (Write failed)
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: Retrying request
    Uploading: http://localhost:8080/manager/text/deploy?path=%2Fhelloworld
    2/23235 KB
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: I/O exception (java.net.SocketException) caught when processing request: Broken pipe (Write failed)
    Feb 28, 2018 1:11:42 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
    INFO: Retrying request
    Uploading: http://localhost:8080/manager/text/deploy?path=%2Fhelloworld
    2/23235 KB
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 10.061 s
    [INFO] Finished at: 2018-02-28T13:11:42+05:00
    [INFO] Final Memory: 15M/60M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy (default-cli) on project springmvc-helloworld: Cannot invoke Tomcat manager: Broken pipe (Write failed) -> [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
    

    我一直在寻找一段时间,现在无法解决这个问题。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Adnan Khan    7 年前

    在您的tomcatusers中。xml,对于您拥有角色“managerscript”的用户maven,将其更改为manager script。 此外,如果您是从tomcat所在的另一台机器上运行maven,请使用该机器的ip地址,并确保端口8080对通信开放。

    推荐文章