Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

ftpclient class not found?

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Below is the complete listing of error that I am gettin when i try to connect to a remote server thru ftp task via my ant script.

Any solutions/suggestions... plzzz drop it here.
Thanks,

BUILD FAILED
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at org.apache.tools.ant.Project.executeTarget(Project.java:1223)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPCli
at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:1

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:2
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.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
... 5 more
--- Nested Exception ---
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:1

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:2
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.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you download the dependent library?

Ant FTP Task:


Note: This task depends on external libraries not included in the Ant distribution. See Library Dependencies for more information.

 
Kriss Reddy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Ant 1.6.2 and 'C:\apache-ant-1.6.2\lib' folder contains
"ant-commons-net.jar" file. I am not sure whether is this the dependant library file or not! If you know exactly which file is that let me know where to get it from.

Thanks for your reply.
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Library Dependencies link in my last post! It links to the part of this part of the library dependencies:

commons-net.jar
ftp, rexec and telnet tasks
jakarta-oro 2.0.1 or later is required in any case together with commons-net.
For all users, a minimum version of commons-net of 1.2.2 is recommended. Earlier versions did not support autodetection of system type or had significant bugs.

On that page is a link to download commons-net.jar.
 
Kriss Reddy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Carol Enderlin.

I got it goin!
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I get the same error, but I have both the "ant-apache-oro.jar" and the "ant-commons-net.jar" in my "ANT_HOME/lib". I downloaded and untared apache-ant-1.6.2-bin.tar.bz2 when I realized that the SuSE team had removed commons-net from the 9.2 version of ant. Is there any other reasons for this error than missing jar files?

I'm on a suse 9.2 with java version 1.4.2

Below is the output of
%> ant -diagnostics



------- Ant diagnostics report -------
Apache Ant version 1.6.2 compiled on July 16 2004

-------------------------------------------
Implementation Version (JDK1.2+ only)
-------------------------------------------
core tasks : 1.6.2
optional tasks : 1.6.2

-------------------------------------------
ANT_HOME/lib jar listing
-------------------------------------------
ant.home: /usr/local/ant
ant-jai.jar (21351 bytes)
ant-antlr.jar (5659 bytes)
ant-starteam.jar (35463 bytes)
ant-icontract.jar (9713 bytes)
ant-jdepend.jar (8152 bytes)
ant-apache-oro.jar (48015 bytes)
ant-trax.jar (68833 bytes)
ant-apache-regexp.jar (3706 bytes)
ant-jmf.jar (6596 bytes)
ant-jsch.jar (22604 bytes)
ant-apache-bsf.jar (12589 bytes)
ant-netrexx.jar (9990 bytes)
ant-swing.jar (6755 bytes)
xercesImpl.jar (1010675 bytes)
ant-apache-bcel.jar (8609 bytes)
ant-stylebook.jar (2320 bytes)
ant-javamail.jar (6753 bytes)
ant-junit.jar (73665 bytes)
ant-xalan1.jar (4457 bytes)
ant-commons-net.jar (35242 bytes)
ant-commons-logging.jar (3856 bytes)
ant-weblogic.jar (14355 bytes)
ant-apache-log4j.jar (3014 bytes)
ant.jar (999966 bytes)
xml-apis.jar (124724 bytes)
ant-vaj.jar (48623 bytes)
ant-xslp.jar (2236 bytes)
ant-nodeps.jar (407573 bytes)
ant-launcher.jar (8673 bytes)
ant-apache-resolver.jar (4073 bytes)

-------------------------------------------
Tasks availability
-------------------------------------------
image : Missing dependency com.sun.media.jai.codec.FileSeekableStream
sshexec : Missing dependency com.jcraft.jsch.UserInfo
scp : Missing dependency com.jcraft.jsch.UserInfo
cvsversion : Not Available
jdepend : Missing dependency jdepend.xmlui.JDepend
junit : Missing dependency junit.framework.Test

-------------------------------------------
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/local/ant/lib/xercesImpl.jar

-------------------------------------------
System properties
-------------------------------------------
java.runtime.name : Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path : /usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/i386
java.vm.version : 1.4.2_06-b03
ant.library.dir : /usr/local/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 : US
sun.os.patch.level : unknown
java.vm.specification.name : Java Virtual Machine Specification
user.dir : /usr/local
java.runtime.version : 1.4.2_06-b03
java.awt.graphicsenv : sun.awt.X11GraphicsEnvironment
java.endorsed.dirs : /usr/lib/jvm/java-1.4.2-sun-1.4.2.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/local/ant
sun.java2d.fontpath :
java.library.path : /usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/i386/client:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/i386:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/../lib/i386
java.specification.name : Java Platform API Specification
java.class.version : 48.0
java.util.prefs.PreferencesFactory : java.util.prefs.FileSystemPreferencesFactory
os.version : 2.6.8-24.14-default
user.home : /home/soredz
user.timezone : Europe/Stockholm
java.awt.printerjob : sun.print.PSPrinterJob
file.encoding : UTF-8
java.specification.version : 1.4
java.class.path : /usr/local/ant/lib/ant-launcher.jar:/usr/local/ant/lib/ant-jai.jar:/usr/local/ant/lib/ant-antlr.jar:/usr/local/ant/lib/ant-starteam.jar:/usr/local/ant/lib/ant-icontract.jar:/usr/local/ant/lib/ant-jdepend.jar:/usr/local/ant/lib/ant-apache-oro.jar:/usr/local/ant/lib/ant-trax.jar:/usr/local/ant/lib/ant-apache-regexp.jar:/usr/local/ant/lib/ant-jmf.jar:/usr/local/ant/lib/ant-jsch.jar:/usr/local/ant/lib/ant-apache-bsf.jar:/usr/local/ant/lib/ant-netrexx.jar:/usr/local/ant/lib/ant-swing.jar:/usr/local/a nt/lib/xercesImpl.jar:/usr/local/ant/lib/ant-apache-bcel.jar:/usr/local/ant/lib/ant-stylebook.jar:/usr/local/ant/lib/ant-javamail.jar:/usr/local/ant/lib/ant-junit.jar:/usr/local/ant/lib/ant-xalan1.jar:/usr/local/ant/lib/ant-commons-net.jar:/usr/local/ant/lib/ant-commons-logging.jar:/usr/local/ant/lib/ant-weblogic.jar:/usr/local/ant/lib/ant-apache-log4j.jar:/usr/local/ant/lib/ant.jar:/usr/local/ant/lib/xml-apis.jar:/usr/local/ant/lib/ant-vaj.jar:/usr/local/ant/lib/ant-xslp.jar:/usr/local/ant/lib/ ant-nodeps.jar:/usr/local/ant/lib/ant-launcher.jar:/usr/local/ant/lib/ant-apache-resolver.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/lib/tools.jar
user.name : soredz
java.vm.specification.version : 1.0
java.home : /usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre
sun.arch.data.model : 32
user.language : en
java.specification.vendor : Sun Microsystems Inc.
java.vm.info : mixed mode
java.version : 1.4.2_06
java.ext.dirs : /usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/ext
sun.boot.class.path : /usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/rt.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/i18n.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/jsse.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/jce.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/lib/charsets.jar:/usr/lib/jvm/java-1.4.2-sun-1.4.2.06/jre/classes
java.vendor : Sun Microsystems Inc.
file.separator : /
java.vendor.url.bug : http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding : UnicodeLittle
sun.cpu.endian : little
sun.cpu.isalist :


 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The jars dependencies are jars that don't come with ant and don't start with "ant-".

They are listed on the Library Dependencies page. Search for ftp and be sure to get both jars.

jakarta-oro-x.jar
commons-net-x.jar
 
Soren Edzen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this is what you ment, but I solved it like this:
I got the 2 jars "commons-net-1.3.0.jar" and "jakarta-oro-2.0.8.jar" and moved them to ANT_HOME/lib. In an attemt to avoid a possible conflict I moved the two jars "ant-commons-net.jar" and "ant-apache-oro.jar" out of this directory. And it still didn't work. It wasn't untill I moved the later files back into ANT_HOME/lib that it started to work. Am I right in assuming that the jars I thought was nessesary for the ftp-task to work is just some sort of wrappers for the real jars? If it is so then It's a it confusing.
Anyway, thank you very much for putting me in the right direction.

S�ren
 
Carol Enderlin
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, didn't mean to imply that the ant- jars weren't needed, just that they come with ant and that the library dependencies are additional jars that need to be downloaded and added to the lib dir.

Glad to hear you got it working.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!