Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Ant FTP Tasks(Receive a class not found error with ant script and the ftp task.)
Ant FTP Tasks [message #1821503] Thu, 13 February 2020 17:53 Go to next message
Michael Wohlstadter is currently offline Michael WohlstadterFriend
Messages: 5
Registered: February 2020
Junior Member
I have been using Eclipse for a number of years, but this is an issue that isn't really tied to a project.

For most of my projects I have build scripts written for Ant. Some of those scripts use the ftp task to transfer files. I define the task with the tag:

<taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP" />


And make sure that the commons-net (currently commons-net-3.6.jar) is in the classpath.

In the past that was all I had to do. However, after upgrading to 2019-12, I am now getting a class not found error on the taskdef.

taskdef A class needed by class org.apache.tools.ant.taskdefs.optional.net.FTP cannot be found: org/apache/
commons/net/ftp/FTPConnectionClosedException using the classloader AntClassLoader[ < list of jars including the net-commons one> ]


Is there a different way to call the ftp task in Ant scripts?

Thanks,
Michael

[Updated on: Thu, 13 February 2020 19:03]

Report message to a moderator

Re: Ant FTP Tasks [message #1821521 is a reply to message #1821503] Fri, 14 February 2020 04:53 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Have you checked that this class the message says it can't find really is actually in the list of the jars?

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ant FTP Tasks [message #1821556 is a reply to message #1821521] Fri, 14 February 2020 16:57 Go to previous messageGo to next message
Michael Wohlstadter is currently offline Michael WohlstadterFriend
Messages: 5
Registered: February 2020
Junior Member
Yes, I did.

Here is what I looked for and found:
In the file:
C:\Program Files\Java\jre1.8.0_40\lib\commons-net-3.6.jar

following the class hierarchy:
\org\apache\commons\net\ftp\

is:
FTPConnectionClosedException.class (575 bytes 2017-02-11 14:54)


I also verified that the Ant Global Entries includes the commons-net-3.6.jar.

Thanks,
Michael
Re: Ant FTP Tasks [message #1821559 is a reply to message #1821521] Fri, 14 February 2020 17:07 Go to previous messageGo to next message
Michael Wohlstadter is currently offline Michael WohlstadterFriend
Messages: 5
Registered: February 2020
Junior Member
Full error message:

taskdef A class needed by class org.apache.tools.ant.taskdefs.optional.net.FTP cannot be found: org/apache/
 commons/net/ftp/FTPConnectionClosedException using the classloader AntClassLoader[C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-antlr.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-bcel.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-bsf.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-log4j.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-oro.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-regexp.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-resolver.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-apache-xalan2.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-commons-logging.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-commons-net.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-imageio.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-jai.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-javamail.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-jdepend.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-jmf.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-jsch.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-junit.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-junit4.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-junitlauncher.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-launcher.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-netrexx.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-swing.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-testutil.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-xz.jar;C:
 \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant.jar;C:\Program 
 Files\Java\jre1.8.0_40\lib\tools.jar;C:\Program Files\Java\jre1.8.0_40\lib\commons-net-3.6.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\89\0\.cp\ant_tasks\resources-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\171\0\.cp\ant_tasks\director-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\178\0\.cp\lib\jarprocessor-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\180\0\.cp\ant_tasks\metadataRepository-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\183\0\.cp\ant_tasks\pdepublishing-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\186\0\.cp\lib\repository-tools-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\205\0\.cp\ant_tasks\helpbase-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\216\0\.cp\jdtCompilerAdapter.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\657\0\.cp\ant_tasks\emf.ant.tasks.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\668\0\.cp\ant_tasks\importer.ecore.tasks.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\669\0\.cp\ant_tasks\importer.java.tasks.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\670\0\.cp\ant_tasks\importer.rose.tasks.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\689\0\.cp\lib\apitooling-ant.jar;C:
 \Users\***\.p2\pool\plugins\org.eclipse.pde.build_3.10.600.v20191011-0535\lib\pdebuild-ant.jar;C:
 \Program Files\Eclipse\configuration\org.eclipse.osgi\693\0\.cp\ant_tasks\pde-ant.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\828\0\.cp\lib\xinclude.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\65\0\.cp\lib\antsupportlib.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\66\0\.cp\lib\loggers.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\66\0\.cp\lib\antdebug.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\66\0\.cp\lib\remote.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\67\0\.cp\lib\antrunner.jar;C:\Program 
 Files\Eclipse\configuration\org.eclipse.osgi\67\0\.cp\lib\remoteAnt.jar]

[Updated on: Fri, 14 February 2020 17:09]

Report message to a moderator

Re: Ant FTP Tasks [message #1821566 is a reply to message #1821559] Sat, 15 February 2020 06:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Maybe it's because you have both these on the classpath and so maybe it only uses the first one:

C: \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-commons-net.jar;
C:\Program Files\Java\jre1.8.0_40\lib\tools.jar;C:\Program Files\Java\jre1.8.0_40\lib\commons-net-3.6.jar;

Maybe there's some change/regression that it doesn't look in both jars... It seems strange that you added something to the Java installations lib...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ant FTP Tasks [message #1821683 is a reply to message #1821566] Tue, 18 February 2020 15:48 Go to previous messageGo to next message
Michael Wohlstadter is currently offline Michael WohlstadterFriend
Messages: 5
Registered: February 2020
Junior Member
The class FTPConnectionClosedException is present in only C:\Program Files\Java\jre1.8.0_40\lib\commons-net-3.6.jar but is included by FTP in both \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-commons-net.jar and C:\Program Files\Java\jre1.8.0_40\lib\commons-net-3.6.jar.

I have tried only including one or the other commons-net jars, restarting Eclipse, and I still receive the same error.

Note, the inclusion of the commons-net-3.6.jar file is an artifact of when it was required in prior versions of Eclipse.

Did the taskdef definition for ftp change? Historically I successfully used:

<taskdef name="ftp" classname="org.apache.tools.ant.taskdefs.optional.net.FTP" />


Maybe I'm trying to FTP in ant using an obsolete method? I've been using Eclipse since version 2.x and the jars required have changed through the years. For example, the jakarta-oro jar was also required at one point, but has not for a while. Perhaps ftp is now part of the base Eclipse install (as evidenced by the \Users\***\.p2\pool\plugins\org.apache.ant_1.10.7.v20190926-0324\lib\ant-commons-net.jar file, and the call to FTP has changed?

Thanks,
Michael
Re: Ant FTP Tasks [message #1821779 is a reply to message #1821683] Thu, 20 February 2020 05:23 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Sorry, it's a mystery to me. Certainly this ant bundle org.apache.ant_1.10.7.v20190926-0324 looks like a newer one and that his is used by the platform's ant support, so if the exception class is missing there, perhaps it was somehow bundles incorrectly or the nested jar was incorrect at the source.

You might try to open a Bug report against Orbit with enough details that anyone can easily reproduce the problem (i.e., a test case) and hope that indeed if it is a problem specific to that version that it will be fixed with a newer version.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ant FTP Tasks [message #1821819 is a reply to message #1821779] Thu, 20 February 2020 15:44 Go to previous message
Michael Wohlstadter is currently offline Michael WohlstadterFriend
Messages: 5
Registered: February 2020
Junior Member
Will do. Thanks for spending time to help troubleshoot this.

Michael
Previous Topic:Secure Storage
Next Topic:IProgressMonitor accessible from more one module
Goto Forum:
  


Current Time: Tue Mar 19 03:46:44 GMT 2024

Powered by FUDForum. Page generated in 0.03850 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top