Answers: <p>It could be disk space, or hot deploy. For hot deploy, you can put the following parameters:</p>
  
  <pre><code>...
  &lt;target name="tomcat-stop"&gt;
      &lt;exec executable="${server.home}/bin/catalina.bat"&gt;
          &lt;arg value="stop"/&gt;
      &lt;/exec&gt;
  &lt;/target&gt;
  
  &lt;target name="tomcat-start"&gt;
      &lt;exec executable="${server.home}/bin/startup.bat"&gt;
          &lt;arg value="start"/&gt;
      &lt;/exec&gt;
  &lt;/target&gt;
  ...
  &lt;target name="all" depends="tomcat-stop,clean,init,compile,junit-slow,make_war,deploy,tomcat-start"&gt;&lt;/target&gt;
  </code></pre>
  
  <p>The answer is at this link: <a href="https://stackoverflow.com/a/32482795/8442153">https://stackoverflow.com/a/32482795/8442153</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-17T21:48:15.480Z
Answers: 2018-10-17T21:48:15.480Z
Answers: dalmo.santos
Body: <p>I am using Ant to deploy a war to a Tomcat server, but it gives me the following error:</p>
  
  <pre><code>    BUILD FAILED
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/build.xml:37: The following error occurred while executing this line:
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/ant_scripts/deploy_wars.xml:36: The following error occurred while executing this line:
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/ant_scripts/deploy_wars.xml:42: java.io.IOException: Error writing to server
          at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:699)
          at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:711)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1585)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
          at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:223)
          at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:350)
          at org.apache.tools.ant.Target.execute(Target.java:448)
          at org.apache.tools.ant.Target.performTasks(Target.java:469)
          at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
          at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
          at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
          at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:446)
          at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  </code></pre>
  
  <p>Here is the Ant target that I use for this deployment (and here is the line where the exception is thrown):</p>
  
  <pre><code>    &lt;target name="deploy-debug" description="Install DEBUG"&gt;
          &lt;deploy url="http://debug.webiste.ro:8180/manager" username="admin" password="password"
                  path="/debug-war" war="wars/debug-war.war"/&gt;
      &lt;/target&gt;
  </code></pre>
  
  <p>I am using Tomcat 9.0.10 and Ant 1.10.3 on Ubuntu 18.04.</p>
  
  <p>I saw some people suggesting that the tomcat user is not properly defined in tomcat_users.xml. I have modified it, but it still gives me the exception when I try to deploy. I can succsefully login on the Tomcat manager app in the browser. Here is my tomcat_users.xml:</p>
  
  <pre><code>    &lt;tomcat-users xmlns="http://tomcat.apache.org/xml"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
            version="1.0"&gt;
            &lt;role rolename="tomcat"/&gt;
            &lt;role rolename="manager-script"/&gt;
            &lt;role rolename="manager-gui"/&gt;
            &lt;role rolename="admin-gui"/&gt;
            &lt;role rolename="admin-script"/&gt;
            &lt;user username="admin" password="password" roles="manager-gui,manager-script,admin-gui,admin-script"/&gt;
      &lt;/tomcat-users&gt;
  </code></pre>
  
  <p>The war file that I am trying to deploy has 80 Mb which is bigger than the default maximum upload value of Tomcat (50 Mb). I have tried increasing the maximum upload value to 100 Mb but it still gives me the Exception.</p>
  
  <p>Any ideas on this problem?</p>
  
Tags: <deployment><tomcat><ant>
Title: Tomcat deploy war with Ant - error writing to server
UserDisplayName: George Cristian
ThreadText: # Tomcat deploy war with Ant - error writing to server
  
  (Asked by: username_0 on 2018-10-17)
  
  I am using Ant to deploy a war to a Tomcat server, but it gives me the following error:
  
  ```
      BUILD FAILED
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/build.xml:37: The following error occurred while executing this line:
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/ant_scripts/deploy_wars.xml:36: The following error occurred while executing this line:
      /home/deploy/Documents/Work/Deploy_Wars/xrepo/deployment/ant_scripts/deploy_wars.xml:42: java.io.IOException: Error writing to server
          at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:699)
          at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:711)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1585)
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
          at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:223)
          at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
          at org.apache.tools.ant.Task.perform(Task.java:350)
          at org.apache.tools.ant.Target.execute(Target.java:448)
          at org.apache.tools.ant.Target.performTasks(Target.java:469)
          at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
          at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
          at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
          at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:446)
          at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
  
  ```
  
  Here is the Ant target that I use for this deployment (and here is the line where the exception is thrown):
  
  ```
      <target name="deploy-debug" description="Install DEBUG">
          <deploy url="http://debug.webiste.ro:8180/manager" username="admin" password="password"
                  path="/debug-war" war="wars/debug-war.war"/>
      </target>
  
  ```
  
  I am using Tomcat 9.0.10 and Ant 1.10.3 on Ubuntu 18.04.
  
  I saw some people suggesting that the tomcat user is not properly defined in tomcat\_users.xml. I have modified it, but it still gives me the exception when I try to deploy. I can succsefully login on the Tomcat manager app in the browser. Here is my tomcat\_users.xml:
  
  ```
      <tomcat-users xmlns="http://tomcat.apache.org/xml"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
            version="1.0">
            <role rolename="tomcat"/>
            <role rolename="manager-script"/>
            <role rolename="manager-gui"/>
            <role rolename="admin-gui"/>
            <role rolename="admin-script"/>
            <user username="admin" password="password" roles="manager-gui,manager-script,admin-gui,admin-script"/>
      </tomcat-users>
  
  ```
  
  The war file that I am trying to deploy has 80 Mb which is bigger than the default maximum upload value of Tomcat (50 Mb). I have tried increasing the maximum upload value to 100 Mb but it still gives me the Exception.
  
  Any ideas on this problem?
  
  **Tags:** deployment, tomcat, ant
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-17. Score: 1
  
  It could be disk space, or hot deploy. For hot deploy, you can put the following parameters:
  
  ```
  ...
  <target name="tomcat-stop">
      <exec executable="${server.home}/bin/catalina.bat">
          <arg value="stop"/>
      </exec>
  </target>
  
  <target name="tomcat-start">
      <exec executable="${server.home}/bin/startup.bat">
          <arg value="start"/>
      </exec>
  </target>
  ...
  <target name="all" depends="tomcat-stop,clean,init,compile,junit-slow,make_war,deploy,tomcat-start"></target>
  
  ```
  
  The answer is at this link: <https://stackoverflow.com/a/32482795/8442153>
  
  
  ---
  
  