AntStructure task gives NoClassDefFoundError

Bug #238487 reported by Rodney Lorrimar
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ant (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: ant

ant 1.7.0-3 on Ubuntu 8.04

When I try to build the attached project which has an AntStructure task, I get the following error (ant -v):

Apache Ant version 1.7.0 compiled on August 29 2007
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.06/jre
Detected OS: Linux
parsing buildfile /home/rodney/build.xml with URI = file:/home/rodney/build.xml
Project base dir set to: /home/rodney
Build sequence for target(s) `dtd' is [dtd]
Complete build sequence is [dtd, ]

dtd:
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.

BUILD FAILED
/home/rodney/build.xml:4: java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig
 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
 at org.apache.tools.ant.Task.perform(Task.java:348)
 at org.apache.tools.ant.Target.execute(Target.java:357)
 at org.apache.tools.ant.Target.performTasks(Target.java:385)
 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
 at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
 at org.apache.tools.ant.Main.runBuild(Main.java:698)
 at org.apache.tools.ant.Main.startAnt(Main.java:199)
 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig
 at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.getValidLanguageCodes(FTP.java:2535)
 at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.<clinit>(FTP.java:2532)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at org.apache.tools.ant.taskdefs.AntStructure$DTDPrinter.printElementDecl(AntStructure.java:352)
 at org.apache.tools.ant.taskdefs.AntStructure.execute(AntStructure.java:114)
 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
 ... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClientConfig
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 ... 27 more
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClientConfig
 at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.getValidLanguageCodes(FTP.java:2535)
 at org.apache.tools.ant.taskdefs.optional.net.FTP$LanguageCode.<clinit>(FTP.java:2532)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at java.lang.Class.newInstance0(Class.java:355)
 at java.lang.Class.newInstance(Class.java:308)
 at org.apache.tools.ant.taskdefs.AntStructure$DTDPrinter.printElementDecl(AntStructure.java:352)
 at org.apache.tools.ant.taskdefs.AntStructure.execute(AntStructure.java:114)
 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
 at org.apache.tools.ant.Task.perform(Task.java:348)
 at org.apache.tools.ant.Target.execute(Target.java:357)
 at org.apache.tools.ant.Target.performTasks(Target.java:385)
 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
 at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
 at org.apache.tools.ant.Main.runBuild(Main.java:698)
 at org.apache.tools.ant.Main.startAnt(Main.java:199)
 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClientConfig
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 ... 27 more

Total time: 4 seconds

Here is the result of ant -diagnostics:

------- Ant diagnostics report -------
Apache Ant version 1.7.0 compiled on August 29 2007

-------------------------------------------
 Implementation Version
-------------------------------------------
core tasks : 1.7.0
optional tasks : not available

-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
ant.version: Apache Ant version 1.7.0 compiled on August 29 2007
ant.java.version: 1.6
ant.core.lib: /usr/share/ant/lib/ant.jar
ant.home: /usr/share/ant

-------------------------------------------
 ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /usr/share/ant
ant-apache-log4j.jar (3042 bytes)
ant.jar (1327716 bytes)
ant-apache-bsf.jar (4047 bytes)
ant-apache-oro.jar (40144 bytes)
ant-commons-logging.jar (4035 bytes)
ant-apache-regexp.jar (3743 bytes)
ant-jmf.jar (6599 bytes)
catalina5.5-ant-jmx.jar (23748 bytes)
ant-jdepend.jar (8290 bytes)
ant-jsch.jar (30640 bytes)
ant-swing.jar (6715 bytes)
ant-apache-bcel.jar (8784 bytes)
junit.jar (70424 bytes)
ant-nodeps.jar (436656 bytes)
ant-trax.jar (6908 bytes)
bcel.jar (528673 bytes)
catalina5.5-ant.jar (26650 bytes)
tomcat5.5-jkstatus-ant.jar (30928 bytes)
ant-launcher.jar (11814 bytes)
ant-apache-resolver.jar (4064 bytes)
jsch.jar (199934 bytes)
ant-bootstrap.jar (16489 bytes)
ant-javamail.jar (7166 bytes)
ant-junit.jar (94264 bytes)
ant-antlr.jar (5912 bytes)
ant-commons-net.jar (47957 bytes)

-------------------------------------------
 USER_HOME/.ant/lib jar listing
-------------------------------------------
user.home: /home/rodney
No such directory.

-------------------------------------------
 Tasks availability
-------------------------------------------
image : Not Available (the implementation class is not present)
wlrun : Not Available (the implementation class is not present)
stlist : Not Available (the implementation class is not present)
netrexxc : Not Available (the implementation class is not present)
starteam : Not Available (the implementation class is not present)
stylebook : Not Available (the implementation class is not present)
stlabel : Not Available (the implementation class is not present)
jdepend : Missing dependency jdepend.xmlui.JDepend
stcheckin : Not Available (the implementation class is not present)
stcheckout : Not Available (the implementation class is not present)
ejbc : Not Available (the implementation class is not present)
wlstop : Not Available (the implementation class is not present)
ddcreator : Not Available (the implementation class is not present)
A task being missing/unavailable should only matter if you are trying to use it

-------------------------------------------
 org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/

-------------------------------------------
 XML Parser information
-------------------------------------------
XML Parser : org.apache.xerces.jaxp.SAXParserImpl
XML Parser Location: /usr/share/java/xercesImpl.jar
Namespace-aware parser : org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
Namespace-aware parser Location: /usr/share/java/xercesImpl.jar

-------------------------------------------
 System properties
-------------------------------------------
java.runtime.name : Java(TM) SE Runtime Environment
sun.boot.library.path : /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386
java.vm.version : 10.0-b22
ant.library.dir : /usr/share/ant/lib
java.vm.vendor : Sun Microsystems Inc.
java.vendor.url : http://java.sun.com/
path.separator : :
java.vm.name : Java HotSpot(TM) Client VM
file.encoding.pkg : sun.io
user.country : AU
sun.java.launcher : SUN_STANDARD
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /home/rodney
java.runtime.version : 1.6.0_06-b02
java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
java.endorsed.dirs : /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/endorsed
os.arch : i386
java.io.tmpdir : /tmp
line.separator :

java.vm.specification.vendor : Sun Microsystems Inc.
os.name : Linux
ant.home : /usr/share/ant
sun.jnu.encoding : UTF-8
java.library.path : /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
java.specification.name : Java Platform API Specification
java.class.version : 50.0
sun.management.compiler : HotSpot Client Compiler
os.version : 2.6.24-18-generic
user.home : /home/rodney
user.timezone : Europe/Warsaw
java.awt.printerjob : sun.print.PSPrinterJob
file.encoding : UTF-8
java.specification.version : 1.6
user.name : rodney
java.class.path : /usr/share/ant/lib/ant-launcher.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/xercesImpl.jar:/usr/share/ant/lib/ant-apache-log4j.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-apache-bsf.jar:/usr/share/ant/lib/ant-apache-oro.jar:/usr/share/ant/lib/ant-commons-logging.jar:/usr/share/ant/lib/ant-apache-regexp.jar:/usr/share/ant/lib/ant-jmf.jar:/usr/share/ant/lib/catalina5.5-ant-jmx.jar:/usr/share/ant/lib/ant-jdepend.jar:/usr/share/ant/lib/ant-jsch.jar:/usr/share/ant/lib/ant-swing.jar:/usr/share/ant/lib/ant-apache-bcel.jar:/usr/share/ant/lib/junit.jar:/usr/share/ant/lib/ant-nodeps.jar:/usr/share/ant/lib/ant-trax.jar:/usr/share/ant/lib/bcel.jar:/usr/share/ant/lib/catalina5.5-ant.jar:/usr/share/ant/lib/tomcat5.5-jkstatus-ant.jar:/usr/share/ant/lib/ant-launcher.jar:/usr/share/ant/lib/ant-apache-resolver.jar:/usr/share/ant/lib/jsch.jar:/usr/share/ant/lib/ant-bootstrap.jar:/usr/share/ant/lib/ant-javamail.jar:/usr/share/ant/lib/ant-junit.jar:/usr/share/ant/lib/ant-antlr.jar:/usr/share/ant/lib/ant-commons-net.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/lib/tools.jar
java.vm.specification.version : 1.0
sun.arch.data.model : 32
java.home : /usr/lib/jvm/java-6-sun-1.6.0.06/jre
java.specification.vendor : Sun Microsystems Inc.
user.language : en
java.vm.info : mixed mode, sharing
java.version : 1.6.0_06
java.ext.dirs : /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/ext:/usr/java/packages/lib/ext
sun.boot.class.path : /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/resources.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/jsse.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/charsets.jar:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/classes
java.vendor : Sun Microsystems Inc.
file.separator : /
java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
sun.cpu.endian : little
sun.io.unicode.encoding : UnicodeLittle
sun.desktop : gnome
sun.cpu.isalist :

-------------------------------------------
 Temp dir
-------------------------------------------
Temp dir is /tmp
Temp dir is writeable
Temp dir alignment with system clock is -925 ms

-------------------------------------------
 Locale information
-------------------------------------------
Timezone Central European Time offset=7200000

-------------------------------------------
 Proxy information
-------------------------------------------
Java1.5+ proxy settings:
Direct connection

Revision history for this message
Rodney Lorrimar (rodney-rodney) wrote :
Revision history for this message
Matthias Klose (doko) wrote :

is this still seen when installing ant-optional?

Changed in ant:
status: New → Incomplete
Revision history for this message
Rodney Lorrimar (rodney-rodney) wrote :

I have ant-optional installed and can still see the problem.

Can you reproduce the problem with the attached build.xml? It is a very small file.

Revision history for this message
Xiaofeng Han (hhhanxf) wrote :

try to download apache net package from http://dev.xiaonei.com/apache-mirror/commons/net/binaries/commons-net-1.4.1.tar.gz

Unpack it and place the jar file into your ant CLASSPATH, then try again.

Good luck.

Revision history for this message
Xiaofeng Han (hhhanxf) wrote :

Another option is download DTD file at http://xmlbuddy.com/DTD/ant151.dtd

Revision history for this message
Rodney Lorrimar (rodney-rodney) wrote :

Yes that works, thanks.

I also installed the libcommons-net-java package and changed the ant command line to this:

ant -lib /usr/share/java/commons-net.jar dtd

And that also works.

致谢

Changed in ant:
status: Incomplete → Confirmed
Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Not an ant error. Missing build dependency caused the failure. Please feel free to reopen if you disagree.

Changed in ant:
status: Confirmed → Invalid
Revision history for this message
Rodney Lorrimar (rodney-rodney) wrote :

Why is it that it's not necessary to put e.g. the JUnit jar in -lib, but it is necessary to put commons-net? They are both optional dependencies.

The <dtd> task loads all of ant's tasks and the only one which fails is <ftp>, which needs commons-net in the classpath.

Seems like a packaging problem to me. Perhaps there needs to be a symlink in /usr/share/ant/lib.

Changed in ant:
assignee: nobody → onkarshinde
status: Invalid → Confirmed
Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Rodney,

Please don't assign bugs to me. If I am going to work on something I will assign it to myself.

I will try to take a look at this issue but it may not happen immediately.

Changed in ant:
assignee: onkarshinde → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers