Menu

Exception on running client xml

Help
2008-06-05
2023-02-17
  • Heema Jetty

    Heema Jetty - 2008-06-05

    Hi,

    I am trying to get ant tasks done on remote machine using  remote ant. I am getting java.io.EOFException on running client xml from local machine.

    1. I have downloaded the ant-contrib jar and placed in it in the ANT home installation's lib directory.

    2.  I have 2 files on remote machine: (10.1.32.18)
         antServer.xml-- to start the remote ant server
         remoteAnt.xml-- the remote xml file that is to be excecuted

    3. On my local machine I have one file:
         antClient.xml

    4. I started the ant server on the remote machine using antServer.xml

    5. On running antClient.xml from my local machine using the command : (10.1.32.19)
       ant -f antClient.xml  -Dant.home=D:/SBMPR_610c/ant

       I get the following error:
      
       Buildfile: antClient.xml
       all:
       BUILD FAILED
       D:\remote-ant\antClient.xml:12: java.io.EOFException   

    I have included the files contents below:

    antServer.xml

    <?xml version="1.0"?>

    <project name="antServer" default="all" basedir=".">
        <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
               <classpath>
                   <pathelement location="${ant.home}/lib/ant-contrib.jar"/>
               </classpath>
        </taskdef>

        <target name="all" >
            <antserver port="12345" />
        </target>  
       
        <target name="echoMessage" >
            <echo message="antServer:: Hello!How are you?"/>       
        </target>
       
    </project>

    antClient.xml

    <?xml version="1.0"?>

    <project name="antClient" default="all" basedir=".">

        <taskdef resource="net/sf/antcontrib/antcontrib.properties" >
                <classpath>
                    <pathelement location="${ant.home}/lib/ant-contrib.jar"/>
                </classpath>
        </taskdef>
       
        <target name="all" >
             <remoteant machine="10.1.32.18" port="12345">
                <runtarget target="echoMessage">                      
                </runtarget>                   
                <runant antfile="remoteAnt.xml" target="all"  inheritall="true">                   
                </runant>

                <sendfile file="abc.xml" tofile="abc1.xml">
                </sendfile>
            </remoteant>   
    </target>  
       
    </project>

    remoteAnt.xml

    <?xml version="1.0"?>

    <project name="remoteAnt" default="all" basedir=".">

        <target name="all" >
            <echo message="remoteAnt:: Hello!How are you?"/>   
        </target>
       
    </project>

    Can anyone help me out if I am missing any step or any other mistake.

    Thanks in advance,
    Heema

     
    • Brian  Murphy

      Brian Murphy - 2008-09-17

      I'm getting the same problem with almost identical files. In fact my "antClient.xml" equivalent just calls the "echoMessage" target and nothing more. I get the Exception below.

      Surely this is working for someone, if anyone has a full sample?

      Thanks,

      Brian

      runAntServer.xml

      <project name="antServer" default="runAntServer">

          <taskdef resource="net/sf/antcontrib/antcontrib.properties">
              <classpath>
                  <pathelement location="ant-contrib-1.0b3.jar"/>
              </classpath>
          </taskdef>

          <target name="runAntServer">
              <antserver port="12345" />
          </target>

          <target name="testMessage">
              <echo message="Remotely run target." />
          </target>

      </project>

      callRemoteTarget.xml

      <project name="remoteClient" default="callServerTarget">

          <taskdef resource="net/sf/antcontrib/antcontrib.properties">
              <classpath>
                  <pathelement location="ant-contrib-1.0b3.jar"/>
              </classpath>
          </taskdef>

          <target name="callServerTarget">
          <remoteant machine="localhost" port="12345">
              <runtarget target="testMessage"/>
              </remoteant>
          </target>

      </project>

      D:\Data\dev\antservertest>ant -v -f remoteclient.xml
      Apache Ant version 1.6.5 compiled on June 2 2005
      Buildfile: remoteclient.xml
      Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.6.0_03\jre
      Detected OS: Windows XP
      parsing buildfile D:\Data\dev\antservertest\remoteclient.xml with URI = file:///
      D:/Data/dev/antservertest/remoteclient.xml
      Project base dir set to: D:\Data\dev\antservertest
      Build sequence for target(s) `callServerTarget' is [callServerTarget]
      Complete build sequence is [callServerTarget, ]

      callServerTarget:

      BUILD FAILED

      D:\Data\dev\antservertest\remoteclient.xml:9: java.io.EOFException
              at net.sf.antcontrib.antserver.client.ClientTask.execute(ClientTask.java
      :200)
              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:341)
              at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
      142)
              at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
      a:91)
              at org.apache.tools.ant.Main.runBuild(Main.java:653)
              at org.apache.tools.ant.Main.startAnt(Main.java:187)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
      Caused by: java.io.EOFException
              at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputSt
      ream.java:2552)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
              at net.sf.antcontrib.antserver.client.Client.sendCommand(Client.java:233
      )
              at net.sf.antcontrib.antserver.client.ClientTask.execute(ClientTask.java
      :144)
              ... 9 more
      --- Nested Exception ---
      java.io.EOFException
              at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputSt
      ream.java:2552)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
              at net.sf.antcontrib.antserver.client.Client.sendCommand(Client.java:233
      )
              at net.sf.antcontrib.antserver.client.ClientTask.execute(ClientTask.java
      :144)
              at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
              at org.apache.tools.ant.Task.perform(Task.java:364)
              at org.apache.tools.ant.Target.execute(Target.java:341)
              at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
      142)
              at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
      a:91)
              at org.apache.tools.ant.Main.runBuild(Main.java:653)
              at org.apache.tools.ant.Main.startAnt(Main.java:187)
              at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
              at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

       
    • Brian  Murphy

      Brian Murphy - 2008-09-19

      I should probably add that in the above files the "testMessage" target is actually run on the server.

      Also, and I thought I was going crazy, but after confirming with a colleague I remember that the above files were made as a quick proof of concept test for using this part of ant contrib a while back. I initially encountered an EOF Exception but immediately corrected it after I had dodgy syntax (I hadn't put the remoteant task inside a target - it was just sitting between the <project> tags) . After that these files worked and I passed them on to my colleague who says they also worked for her, then failed recently. The same is now happening for me after I dug these same files up from a few weeks back for a sanity check.

      Apologies for the vague narrative but this was 10 mins of my day a few weeks back and I thought I'd give you the full, unlikely, story. I can't think of what could have changed on my environment that could have prompted this.

       
  • Anonymous

    Anonymous - 2011-10-07

    Hi, did you manage to solve this problem ?  Please let me know.

     
  • Bornali

    Bornali - 2011-12-08

    Yes as Brian mentions above it did work on my machine when he passed that project over to me few years back, and had to redo this on another machine after so many years and still had the same issue. I got it working now by including the following jar in ant's lib folder:  xerces-2.6.2.jar

    Cheers.

     
  • Brian  Murphy

    Brian Murphy - 2012-02-13

    Good to know such a robust system is still running :D

     
  • nobuhiko

    nobuhiko - 2012-04-05

    In my case, I added xercesImpl.jar from Xerces-J-bin.2.11.0, and xml-apis.jar from xml-commons-external-1.4.01.

     
  • StefMeisterSF

    StefMeisterSF - 2012-12-20

    Adding xerces or other jars did not solve the problem for me. However, I have been able to work around the problem by using runant instead of runtarget. In you original example this would mean, use

    <remoteant machine="localhost" port="12345">
        <runant antfile="antServer.xml" target="testMessage">
    </remoteant>
    

    instead of

    <remoteant machine="localhost" port="12345">
        <runtarget target="testMessage"/>
    </remoteant>
    
     
  • StefMeisterSF

    StefMeisterSF - 2012-12-20

    Forget, the post above. It were the xercesImpl.jar and xml-apis.jar file all along. However, you have to add them to the libs for the server side ant call, not the client.

     
  • tulasi ram

    tulasi ram - 2013-05-28

    Hi guys,

    I am new to ANT, I have a simple ant target in machine 1 which is mentioned below to run the TestNG format selenium scripts, I have to run this target in machine 2 and machine 3 can you please help on this how to run this target on remote machines(2)

     

    Last edit: tulasi ram 2013-05-29

Log in to post a comment.