Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File


    a program of mine is making a call to this method . It was working fine till before few days. and now it is throwing this exception.
    Since the exception is from an apache FileUtils class,it cant be any problem with my program also. So what could be the possible cause for this?


  2. #2
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    Could the program be executed with a different definition of the class than it was compiled with?
    The one used for compilation had the method, the one for execution did not.

    Read the API doc for the error message.

  3. #3
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    Quote Originally Posted by Norm View Post
    Could the program be executed with a different definition of the class than it was compiled with?
    The one used for compilation had the method, the one for execution did not.

    Read the API doc for the error message.





    But my doubt is, the code I am executing is that of a standard tool which is installed in the cluster since a long time.
    How can execution with a different definition of the class happen after compiling?

  4. #4
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    How can execution with a different definition of the class happen after compiling?
    The code was compiled with jarFileA and executed with jarFileB which has a different definition for the class.

  5. #5
    Junior Member
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    ok ,got it Norm. Thank you. I will get back in case I get any doubts further.

  6. #6
    Junior Member
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    I have seen a similar issue with sqoop... but i dont know if that could help you

  7. #7
    Junior Member
    Join Date
    Sep 2015
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    Quote Originally Posted by Pranay2013 View Post
    I have seen a similar issue with sqoop... but i dont know if that could help you
    Hey Pranay,

    I am facing the same issue with sqoop. Can you help for that... I am trying to do import from mysql to hdfs using sqoopoptions.

    Its feeling like i am stuck here for ages....

    --- Update ---

    Here is my code...

    import com.cloudera.sqoop.SqoopOptions;
    import com.cloudera.sqoop.tool.ImportTool;

    @SuppressWarnings("deprecation")
    public class ScoopExp {

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    setUp();
    // TransferringEntireTable("abc");
    TansferringEntireTableSpecificDir("abc","/user/hduser/abc/");
    runIt();
    }

    private static SqoopOptions SqoopOptions = new SqoopOptions();
    private static final String connectionString = "jdbc:mysql://localhost/test";
    private static final String username = "root";
    private static final String password = "root";

    private static void setUp() {
    System.out.println("In Setup");
    System.out.println(connectionString);
    SqoopOptions.setConnectString(connectionString);
    SqoopOptions.setUsername(username);
    SqoopOptions.setPassword(password);
    }

    private static void TransferringEntireTable(String table) {
    System.out.println("In 1");
    SqoopOptions.setTableName(table);
    }

    private static void TansferringEntireTableSpecificDir(String table,
    String directory) {
    System.out.println("In 2");
    TransferringEntireTable(table);
    SqoopOptions.setWarehouseDir(directory);
    }

    private static int runIt() {
    int res;
    System.out.println(SqoopOptions);
    res = new ImportTool().run(SqoopOptions);
    if (res != 0) {
    throw new RuntimeException("Sqoop API Failed - return code : "+Integer.toString(res));
    }
    return res;
    }

    }

  8. #8

    Default Re: Exception java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.moveFile(Ljava/io/File;Ljava/io/File;)

    The code was compiled with jarFileA and executed with jarFileB.

Similar Threads

  1. need help with 'org.apache.commons.net.ftp.FTPClient'
    By rtumatt in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: May 22nd, 2013, 07:02 PM
  2. Uploading File to server ( Apache.commons.net)
    By quirell in forum Java Networking
    Replies: 5
    Last Post: November 11th, 2012, 10:06 PM
  3. problem while sending email using org.apache.commons.mail.*
    By gurleen in forum Java Theory & Questions
    Replies: 2
    Last Post: September 10th, 2012, 11:21 AM
  4. Replies: 3
    Last Post: March 7th, 2012, 04:54 AM
  5. OSGI - missing imported package=org.apache.commons.collections
    By rcbandit in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 17th, 2012, 10:36 AM

Tags for this Thread