How to rectify this Ant Build Error

Discussions

General J2EE: How to rectify this Ant Build Error

  1. How to rectify this Ant Build Error (3 messages)

    I am new bie for using ANT build tool.

    I did download Ant1.6 and configured the Environmental Settings ANT_HOME to c:\ant

    I tried with a very basic one created a simple java file and then a basic build.xml

    and when i tried c:>ant

    I got the following Error

    BUILD FAILED
    java.lang.AbstractMethodError: javax.xml.parsers.SAXParser.getXMLReader()Lorg/xm
    l/sax/XMLReader;
            at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.j
    ava:193)
            at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
    215)
            at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
    162)
            at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
    a:126)
            at org.apache.tools.ant.Main.runBuild(Main.java:650)
            at org.apache.tools.ant.Main.startAnt(Main.java:220)
            at org.apache.tools.ant.launch.Launcher.run(Launcher.java:162)
            at org.apache.tools.ant.launch.Launcher.main(Launcher.java:85)

    Total time: 0 seconds
    java.lang.AbstractMethodError: javax.xml.parsers.SAXParser.getXMLReader()Lorg/xm
    l/sax/XMLReader;
            at org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.j
    ava:193)
            at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
    215)
            at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:
    162)
            at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav
    a:126)
            at org.apache.tools.ant.Main.runBuild(Main.java:650)
            at org.apache.tools.ant.Main.startAnt(Main.java:220)
            at org.apache.tools.ant.launch.Launcher.run(Launcher.java:162)
            at org.apache.tools.ant.launch.Launcher.main(Launcher.java:85)
    javax.xml.parsers.SAXParser.getXMLReader()Lorg/xml/sax/XMLReader;


    can anyone please tell me what is wrong in it?
  2. Which JDK are you using? javax.xml.parsers.SAXParser is part of the JAXP 1.0 wich is avaiable only from JDK 1.4 or later.

    If you are using a prior JDK version, download the JAXP implementation from Sun.

    This exception is thrown because Ant was built using JDK 1.4. When you try to use it on previous versions, the JVM will not be able to find the SAXParser class and will throw the AbstractMethodError error.
  3. Yeah you are right.. I used JDK 1.2 only.. ..btw i fixed it by deleting the first line(<?xml version="1.0"?>) and tried..it does it..any way i am going to download JAXP implementation ..

    Thanks for your suggestion.
  4. Despite the fact that I am using JDK/JRE6