Bug 838711

Summary: ant builds are failing with Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: antAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: akurtako, java-sig-commits, jcapik, kdaniel, mizdebsk, mmatejov, msrb, tradej
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.9.1-3 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-02 10:03:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Orion Poplawski 2012-07-09 22:04:13 UTC
Description of problem:

gridengine builds are failing in rawhide with:

/builddir/build/BUILD/GE2011.11p1/source/libs/jdrmaa/build.xml:35: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML

http://koji.fedoraproject.org/koji/getfile?taskID=4227924&name=build.log

Works fine in F17.  Last successful koji build in rawhide is from April 17th.  I wasn't able to fix by downgrading ant (and a number of other java libraries), so I'm not sure what is causing it.

Version-Release number of selected component (if applicable):
ant-1.8.4-1.fc18.noarch

drmaa:
     [echo] myant: Doing target="" on directory "libs/jdrmaa"
     [java] Executing '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/jre/bin/java' with arguments:
     [java] '-Djava.compiler=none'
     [java] '-classpath'
     [java] '/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/antlr.jar:/usr/share/java/ant/ant-antlr.jar:/usr/share/java/bcel.jar:/usr/share/java/ant/ant-apache-bcel.jar:/usr/share/java/bsf.jar:/usr/share/java/ant/ant-apache-bsf.jar:/usr/share/java/log4j.jar:/usr/share/java/ant/ant-apache-log4j.jar:/usr/share/java/oro.jar:/usr/share/java/ant/ant-apache-oro.jar:/usr/share/java/regexp.jar:/usr/share/java/ant/ant-apache-regexp.jar:/usr/share/java/xml-commons-resolver.jar:/usr/share/java/ant/ant-apache-resolver.jar:/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar:/usr/share/java/ant/ant-apache-xalan2.jar:/usr/share/java/ant/ant-commons-logging.jar:/usr/share/java/ant/ant-commons-net.jar:/usr/share/java/javamail.jar:/usr/share/java/ant/ant-javamail.jar:/usr/share/java/jdepend.jar:/usr/share/java/ant/ant-jdepend.jar:/usr/share/java/ant/ant-jmf.jar:/usr/share/java/jsch.jar:/usr/share/java/ant/ant-jsch.jar:/usr/share/java/jtidy.jar:/usr/share/java/junit.jar:/usr/share/java/ant/ant-junit.jar:/usr/share/java/ant/ant-junit4.jar:/usr/share/java/ant/ant-swing.jar:/usr/share/java/ant/ant-testutil.jar:/usr/lib/jvm/java/lib/tools.jar:/usr/share/ant/lib/ant-testutil.jar:/usr/share/ant/lib/ant-javamail.jar:/usr/share/ant/lib/ant-jsch.jar:/usr/share/ant/lib/ant-apache-bsf.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-apache-regexp.jar:/usr/share/ant/lib/ant-commons-logging.jar:/usr/share/ant/lib/ant-commons-net.jar:/usr/share/ant/lib/ant-apache-bcel.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-apache-oro.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/ant-apache-resolver.jar:/usr/share/ant/lib/ant-jdepend.jar:/usr/share/ant/lib/ant-apache-xalan2.jar:/usr/share/ant/lib/ant-apache-log4j.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-junit4.jar:/usr/share/ant/lib/ant-bootstrap.jar'
     [java] 'org.apache.tools.ant.launch.Launcher'
     [java] 
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.
Execute:Java13CommandLauncher: Executing '/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/jre/bin/java' with arguments:
'-Djava.compiler=none'
'-classpath'
'/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/antlr.jar:/usr/share/java/ant/ant-antlr.jar:/usr/share/java/bcel.jar:/usr/share/java/ant/ant-apache-bcel.jar:/usr/share/java/bsf.jar:/usr/share/java/ant/ant-apache-bsf.jar:/usr/share/java/log4j.jar:/usr/share/java/ant/ant-apache-log4j.jar:/usr/share/java/oro.jar:/usr/share/java/ant/ant-apache-oro.jar:/usr/share/java/regexp.jar:/usr/share/java/ant/ant-apache-regexp.jar:/usr/share/java/xml-commons-resolver.jar:/usr/share/java/ant/ant-apache-resolver.jar:/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar:/usr/share/java/ant/ant-apache-xalan2.jar:/usr/share/java/ant/ant-commons-logging.jar:/usr/share/java/ant/ant-commons-net.jar:/usr/share/java/javamail.jar:/usr/share/java/ant/ant-javamail.jar:/usr/share/java/jdepend.jar:/usr/share/java/ant/ant-jdepend.jar:/usr/share/java/ant/ant-jmf.jar:/usr/share/java/jsch.jar:/usr/share/java/ant/ant-jsch.jar:/usr/share/java/jtidy.jar:/usr/share/java/junit.jar:/usr/share/java/ant/ant-junit.jar:/usr/share/java/ant/ant-junit4.jar:/usr/share/java/ant/ant-swing.jar:/usr/share/java/ant/ant-testutil.jar:/usr/lib/jvm/java/lib/tools.jar:/usr/share/ant/lib/ant-testutil.jar:/usr/share/ant/lib/ant-javamail.jar:/usr/share/ant/lib/ant-jsch.jar:/usr/share/ant/lib/ant-apache-bsf.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-apache-regexp.jar:/usr/share/ant/lib/ant-commons-logging.jar:/usr/share/ant/lib/ant-commons-net.jar:/usr/share/ant/lib/ant-apache-bcel.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-apache-oro.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/ant-apache-resolver.jar:/usr/share/ant/lib/ant-jdepend.jar:/usr/share/ant/lib/ant-apache-xalan2.jar:/usr/share/ant/lib/ant-apache-log4j.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-junit4.jar:/usr/share/ant/lib/ant-bootstrap.jar'
'org.apache.tools.ant.launch.Launcher'

The ' characters around the executable and arguments are
not part of the command.
     [java] Buildfile: /var/tmp/orion/redhat/gridengine-2011.11p1/GE2011.11p1/source/libs/jdrmaa/build.xml
     [java] 
     [java] BUILD FAILED
     [java] /var/tmp/orion/redhat/gridengine-2011.11p1/GE2011.11p1/source/libs/jdrmaa/build.xml:35: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML
     [java] 
     [java] Total time: 0 seconds

BUILD FAILED
/var/tmp/orion/redhat/gridengine-2011.11p1/GE2011.11p1/source/build.xml:48: The following error occurred while executing this line:
/var/tmp/orion/redhat/gridengine-2011.11p1/GE2011.11p1/source/build.xml:27: Java returned: 1
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:392)
        at org.apache.tools.ant.Target.performTasks(Target.java:413)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:811)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 4 seconds

Comment 1 Orion Poplawski 2012-08-03 17:03:01 UTC
Ahh, starting to see this in F17 now.  ant did not change though, so perhaps it's something else.

Comment 2 Orion Poplawski 2012-08-03 20:02:13 UTC
Actually, it stills builds find in F17 mock, but on my F17 box it fails.  I'm starting to suspect some other package influencing it.  The F18 builds bring in a lot more dependencies.  But rawhide builds are also pretty unstable for me too in other ways so hard to test.

Comment 3 Alexander Kurtakov 2013-04-23 16:11:38 UTC
Orion, is this still true on Fedora 18?

Comment 4 Orion Poplawski 2013-04-23 16:37:57 UTC
I do still see this when I build locally on my F18 machine.  koji/mock builds seem okay.

Comment 5 Mikolaj Izdebski 2013-06-13 15:40:30 UTC
Successfully reproduced on Fedora 18.

$ rpm -q ant
ant-1.8.4-5.fc18.noarch

$ cat build.xml 
<project default="run">
  <target name="run">
    <java classname="org.apache.tools.ant.launch.Launcher"
	  fork="true" failonerror="true" dir="sub">
      <classpath>
        <pathelement path="${java.class.path}"/>
      </classpath>
    </java>
  </target>
</project>

$ cat sub/build.xml 
<project/>

$ ant
Buildfile: /tmp/rep/build.xml

run:
     [java] Buildfile: /tmp/rep/sub/build.xml
     [java] 
     [java] BUILD FAILED
     [java] /tmp/rep/sub/build.xml:1: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML
     [java] 
     [java] Total time: 0 seconds

BUILD FAILED
/tmp/rep/build.xml:4: Java returned: 1

Total time: 1 second

Comment 6 Mikolaj Izdebski 2013-06-13 15:52:54 UTC
Reproduced in Rawhide too.

Even simpler reproducer can be used:

$ cat build.xml
<project/>

$ java -cp /usr/share/java/ant-launcher.jar org.apache.tools.ant.launch.Launcher
Buildfile: /tmp/build.xml

BUILD FAILED
/tmp/build.xml:1: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML

Total time: 0 seconds

Comment 7 Mikolaj Izdebski 2013-06-13 16:55:11 UTC
Looks like Ant is failing when it uses Xerces SAX parser, but if xerces-j2 package is erased then Ant works fine with OpenJDK internal parser.

$ cat build.xml
<project/>

$ java -Djaxp.debug=1 -cp /usr/share/java/ant-launcher.jar org.apache.tools.ant.launch.Launcher
Buildfile: /tmp/build.xml
JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
JAXP: found jar resource=META-INF/services/javax.xml.parsers.SAXParserFactory using ClassLoader: java.net.URLClassLoader@73a2335d
JAXP: found in resource, value=org.apache.xerces.jaxp.SAXParserFactoryImpl
JAXP: created new instance of class org.apache.xerces.jaxp.SAXParserFactoryImpl using ClassLoader: java.net.URLClassLoader@73a2335d

BUILD FAILED
/tmp/build.xml:1: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML

Total time: 0 seconds

# rpm -e xerces-j2 --nodeps

$ java -Djaxp.debug=1 -cp /usr/share/java/ant-launcher.jar org.apache.tools.ant.launch.Launcher
Buildfile: /tmp/build.xml
JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
JAXP: loaded from fallback value: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
JAXP: created new instance of class com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using ClassLoader: null

BUILD SUCCESSFUL
Total time: 0 seconds

Comment 8 Mikolaj Izdebski 2013-07-02 08:30:43 UTC
Fixed in ant-1.9.1-3

Comment 9 Mikolaj Izdebski 2013-07-02 10:03:54 UTC
I believe that this bug is fixed in ant-1.9.1-3,
which is available in Fedora Rawhide, so I am closing this bug now.

The build containing the fix can be found at Koji:
http://koji.fedoraproject.org/koji/buildinfo?buildID=430789

This bug was fixed in the next release of Fedora, and is not planned
to be fixed in the release it was filed against.  If you want this bug
to be fixed in updates for Fedora 17, please say so in a comment.
Otherwise you can update to the newer release of Fedora to get the fix.

Comment 10 Michal Srb 2013-08-09 07:06:51 UTC
I think that real problem here is location of the ant{,-launcher}.jar. In all versions prior to 1.9.1-3 the location is /usr/share/java/. And it looks like Ant adds all the JARs from the directory where ant-launcher.jar is located to the classpath:

$ cat build.xml
</project>

$ java -cp /usr/share/java/ant-launcher.jar org.apache.tools.ant.launch.Launcher --launchdiag | grep java.class.path | sed -e 's/:/\n/g'| wc -l

BUILD FAILED
/home/msrb/bug/ant/build.xml:2: Unexpected element "{}HTML" {antlib:org.apache.tools.ant}HTML

Total time: 0 seconds
556

After moving ant{,-launcher}.jar to the subdirectory /usr/share/java/ant/:

$ java -cp /usr/share/java/ant/ant-launcher.jar org.apache.tools.ant.launch.Launcher --launchdiag | grep java.class.path | sed -e 's/:/\n/g'|wc -l

BUILD FAILED
/home/msrb/bug/ant/build.xml:1: The markup in the document preceding the root element must be well-formed.

Total time: 0 seconds
22