title: java.net.socketexception connection reset by peer socket write error While deploying war on Tomcat7 through Jenkins (Using Maven)
body: <p>I am trying to deploy a maven based web project on tomcat7 through Jenkins. When i try to execute maven goal "mvn tomcat7:deploy" from my command prompt, it works all fine and deploy the application on running tomcat7 instance.
  Now i set up a Job on Jenkins for the same Projects and getting socket error. Below is my code and the stacktrace from Jenkins console.</p>
  
  <p>Entry in POM.xml </p>
  
  <pre><code>&lt;plugin&gt;
          &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
          &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.2&lt;/version&gt;
          &lt;configuration&gt;
              &lt;url&gt;http://localhost:8080/manager/text&lt;/url&gt;
              &lt;server&gt;Tomcat7Server&lt;/server&gt;
              &lt;path&gt;/ElecnorMPR&lt;/path&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  </code></pre>
  
  <p>Apache Maven Settings.xml </p>
  
  <pre><code>&lt;server&gt;
    &lt;id&gt;Tomcat7Server&lt;/id&gt;
    &lt;username&gt;tomcat&lt;/username&gt;
    &lt;password&gt;tomcat&lt;/password&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p>Already defined the users in tomcat-user.xml.</p>
  
  <pre><code>    [DEBUG] Connection 0.0.0.0:51036&lt;-&gt;127.0.0.1:8080 closed
  [DEBUG] Closing the connection.
  [DEBUG] Connection 0.0.0.0:51036&lt;-&gt;127.0.0.1:8080 closed
  [INFO] I/O exception (java.net.SocketException) caught when processing request: Connection reset by peer: socket write error
  [DEBUG] Connection reset by peer: socket write error
  
      java.net.SocketException: Connection reset by peer: socket write error
          at java.net.SocketOutputStream.socketWrite0(Native Method)
          at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
          at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
          at org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:181)
          at org.apache.http.impl.conn.LoggingSessionOutputBuffer.write(LoggingSessionOutputBuffer.java:73)
          at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
          at org.apache.tomcat.maven.common.deployer.TomcatManager$RequestEntityImplementation.writeTo(TomcatManager.java:880)
          at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:89)
          at org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
          at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:117)
          at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:265)
          at org.apache.http.impl.conn.ManagedClientConnectionImpl.sendRequestEntity(ManagedClientConnectionImpl.java:203)
          at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:236)
          at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
          at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:682)
          at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486)
          at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
          at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
          at org.apache.tomcat.maven.common.deployer.TomcatManager.invoke(TomcatManager.java:742)
          at org.apache.tomcat.maven.common.deployer.TomcatManager.deployImpl(TomcatManager.java:705)
          at org.apache.tomcat.maven.common.deployer.TomcatManager.deploy(TomcatManager.java:388)
          at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
          at org.apache.tomcat.maven.plugin.tomcat7.deploy.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:82)
          at org.apache.tomcat.maven.plugin.tomcat7.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:132)
          at org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:68)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
          at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
          at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:606)
          at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
          at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
          at hudson.remoting.UserRequest.perform(UserRequest.java:121)
          at hudson.remoting.UserRequest.perform(UserRequest.java:49)
          at hudson.remoting.Request$2.run(Request.java:325)
          at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
  
  [INFO] Retrying request
  [DEBUG] Reopening the direct connection.
  [DEBUG] Connecting to localhost:8080
  [DEBUG] Attempt 2 to execute request
  [DEBUG] Sending request: PUT /manager/text/deploy?path=%2FElecnorMPR HTTP/1.1
  [DEBUG]  &gt;&gt; "PUT /manager/text/deploy?path=%2FElecnorMPR HTTP/1.1[\r][\n]"
  [DEBUG]  &gt;&gt; "User-Agent: Apache Tomcat Maven Plugin/2.2[\r][\n]"
  [DEBUG]  &gt;&gt; "Content-Length: 33093536[\r][\n]"
  [DEBUG]  &gt;&gt; "Host: localhost:8080[\r][\n]"
  [DEBUG]  &gt;&gt; "Connection: Keep-Alive[\r][\n]"
  [DEBUG]  &gt;&gt; "Authorization: Basic dG9tY2F0OnRvbWNhdA==[\r][\n]"
  [DEBUG]  &gt;&gt; "[\r][\n]"
  [DEBUG] &gt;&gt; PUT /manager/text/deploy?path=%2FElecnorMPR HTTP/1.1
  [DEBUG] &gt;&gt; User-Agent: Apache Tomcat Maven Plugin/2.2
  [DEBUG] &gt;&gt; Content-Length: 33093536
  [DEBUG] &gt;&gt; Host: localhost:8080
  [DEBUG] &gt;&gt; Connection: Keep-Alive
  [DEBUG] &gt;&gt; Authorization: Basic dG9tY2F0OnRvbWNhdA==
  Uploading: http://localhost:8080/manager/text/deploy?path=%2FElecnorMPR
  </code></pre>