javamaventomcattomcat7maven-tomcat-plugin

Tomcat7 maven plugin - I/O exception (java.net.SocketException) caught when processing request: Broken pipe


I have been trying to deploy my WAR file using mvn tomcat7:deploy command but I am getting broken pipe errors.I am using Ubuntu. Here are the required files.

Here is the 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>

My /conf/settings.xml for tomcat has

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

And tomcatusers.xml as follows

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

while deploying using following command

mvn tomcat7:deploy

I get these errors

> 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

I have been looking for a while now and unable to resolve this issue.


Solution

  • in your tomcatusers.xml , for the user maven you have role "managerscript" , change it to manager-script. Also if you are running maven from a different machine apart from where tomcat is, please use the ip address of the machine and make sure the port 8080 is open for communication.