Bug 1542899

Summary: Task failure with ant and JAXB's xjc
Product: [Fedora] Fedora Reporter: Peter Hull <peterhull90>
Component: istack-commonsAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: akurtako, jaromir.capik, java-sig-commits, krzysztof.daniel, mgoldman, mizdebsk, msrb
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-30 22:24:24 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:
Embargoed:
Attachments:
Description Flags
Ant build script
none
Example schema file none

Description Peter Hull 2018-02-07 10:09:19 UTC
Created attachment 1392587 [details]
Ant build script

Description of problem:

Running the JAXB xjc task in ant appears to make ant fail at a later stage with classpath problems. The xjc task itself seems to finish correctly.

The background to this is trying to build Netbeans on Fedora 27 fails and I have done some work to narrow down Netbeans build script (which is very large/complicated) to this aspect.
See https://issues.apache.org/jira/browse/NETBEANS-239 and http://mail-archives.apache.org/mod_mbox/incubator-netbeans-dev/201801.mbox/browser

However setting the ANT_HOME explicitly makes this bug disappear.

I believe I have set up the xjc task correctly to run with Fedora's glassfish-jaxb packages.


Version-Release number of selected component (if applicable):
ant.noarch                             1.10.1-7.fc27                    @fedora 
ant-lib.noarch                         1.10.1-7.fc27                    @fedora 
glassfish-jaxb.noarch                  2.2.11-6.fc27                    @fedora 
glassfish-jaxb-api.noarch              2.2.12-7.fc27                    @fedora 
glassfish-jaxb-bom.noarch              2.2.11-6.fc27                    @fedora 
glassfish-jaxb-bom-ext.noarch          2.2.11-6.fc27                    @fedora 
glassfish-jaxb-codemodel.noarch        2.2.11-6.fc27                    @fedora 
glassfish-jaxb-codemodel-annotation-compiler.noarch
glassfish-jaxb-codemodel-parent.noarch 2.2.11-6.fc27                    @fedora 
glassfish-jaxb-core.noarch             2.2.11-6.fc27                    @fedora 
glassfish-jaxb-external-parent.noarch  2.2.11-6.fc27                    @fedora 
glassfish-jaxb-jxc.noarch              2.2.11-6.fc27                    @fedora 
glassfish-jaxb-parent.noarch           2.2.11-6.fc27                    @fedora 
glassfish-jaxb-rngom.noarch            2.2.11-6.fc27                    @fedora 
glassfish-jaxb-runtime.noarch          2.2.11-6.fc27                    @fedora 
glassfish-jaxb-runtime-parent.noarch   2.2.11-6.fc27                    @fedora 
glassfish-jaxb-txw-parent.noarch       2.2.11-6.fc27                    @fedora 
glassfish-jaxb-txw2.noarch             2.2.11-6.fc27                    @fedora 
glassfish-jaxb-txwc2.noarch            2.2.11-6.fc27                    @fedora 
glassfish-jaxb-xjc.noarch              2.2.11-6.fc27                    @fedora 
glassfish-jaxb1-impl.noarch            2.2.11-6.fc27                    @fedora 
java-1.8.0-openjdk.x86_64              1:1.8.0.161-0.b14.fc27           @updates
java-1.8.0-openjdk-devel.x86_64        1:1.8.0.161-0.b14.fc27           @updates
java-1.8.0-openjdk-headless.x86_64     1:1.8.0.161-0.b14.fc27           @updates

How reproducible:
Always

Steps to Reproduce:
1. Use attached build.xml and test.xsd
2. Run ant 
3. See error message
Note this is a minimal build.xml and test.xsd to cause the problem to appear.

Actual results:
build succeeds

Expected results:
Build fails, 
$ ant
Buildfile: .../build.xml

fail:
      [xjc] Consider using <depends>/<produces> so that XJC won't do unnecessary compilation
      [xjc] Compiling file:.../test.xsd
      [xjc] Writing output to .
Caught an exception while logging the end of the build.  Exception was:
java.lang.NoClassDefFoundError: org/apache/tools/ant/util/DateUtils
        at org.apache.tools.ant.DefaultLogger.formatTime(DefaultLogger.java:328)
        at org.apache.tools.ant.DefaultLogger.buildFinished(DefaultLogger.java:177)
        at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2110)
        at org.apache.tools.ant.Main.runBuild(Main.java:878)
        at org.apache.tools.ant.Main.startAnt(Main.java:236)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


Additional info:
This succeeds:
$ ANT_HOME=/usr/share/ant/ ant
Buildfile: .../build.xml

fail:
      [xjc] Consider using <depends>/<produces> so that XJC won't do unnecessary compilation
      [xjc] Compiling file:.../test.xsd
      [xjc] Writing output to .

BUILD SUCCESSFUL
Total time: 1 second

Comment 1 Peter Hull 2018-02-07 10:10:06 UTC
Created attachment 1392588 [details]
Example schema file

Comment 2 Mikolaj Izdebski 2018-02-07 10:41:13 UTC
Reproducible. It looks like ProtectedTask from istack-commons is messing up with Ant class loader, so that it can't find its core classes.

Comment 3 Peter Hull 2018-02-08 09:33:37 UTC
Further information: this doesn't occur on Debian 9. They have an older version of ant (1.9.9) and put all jars into /usr/share/java rather than the way they are organised on Fedora. I wasn't able to check if Debian or Fedora apply any patches to the stock Apache Ant that may be relevant.

Comment 4 Ben Cotton 2018-11-27 14:47:43 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2018-11-30 22:24:24 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.