Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6766577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:50:52+00:00 2026-05-26T14:50:52+00:00

I use the following program to rename a directory, but I got the exception,

  • 0

I use the following program to rename a directory, but I got the exception, which seems that it only assumes that I am using the local file system. Actually, in my core-site.xml, i have already set the fs.default.name to the hdfs, instead of local file system.
So, I want to know the loading order of the configuration files, and why it think that I am using local file system. How to fix it? thanks

`

<configuration>
<property>
 <name>fs.default.name</name>
 <value>hdfs://xiliu:54310</value>
  <final>true</final>`
</property>
<property>
  <name>hadoop.tmp.dir</name>
  <value>/data1/hadoop/hdfs/tmp</value>
  <final>true</final>
 </property>
</configuration>





public class FSUtil extends Configured
{
  private static Configuration conf;

  static
  {
    conf = new Configuration( );
  }

public static void rename( Path srcPath, Path tgtPath)
    throws IOException
  {
    FileSystem fs = FileSystem.get( conf);
    fs.rename( srcPath, tgtPath);
  }


 public static void main(String[]args){
try {
FSUtil.rename(new Path("hdfs://xiliu:54310/user/warehouse/test"), new Path("hdfs://xiliu:54310/user/warehouse/testtmp"));

} catch (IOException e) {
        e.printStackTrace();
    }
  }
}




Exception in thread "main" java.lang.IllegalArgumentException: Wrong FS: hdfs://xiliu:54310/user/warehouse/test, expected: file:///
    at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:354)
    at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:54)
    at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:367)
    at org.apache.hadoop.fs.FileSystem.isDirectory(FileSystem.java:702)
    at org.apache.hadoop.fs.ChecksumFileSystem.rename(ChecksumFileSystem.java:402)
    at com.business.cloudbase.hadoop.fs.FSUtil.rename(FSUtil.java:251)
    at com.business.cloudbase.hadoop.fs.FSUtil.main(FSUtil.java:602)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:50:53+00:00Added an answer on May 26, 2026 at 2:50 pm

    Looks like the configuration files are not in the class path and the fs.default.name parameter is defaulting to file:///.

    Two options

    1. Put the configuration files in the classpath, so that the code picks it.

    2. Use Configuration.set() to set the required parameters in the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following program, DummyMethod always print 5. But if we use the commented
I could use the following: <fileset dir=C:\Program Files\eclipse\plugins\myplugin> <include name=extraStuff.jar /> </fileset> But that
I have a program that makes use of the following method to get a
I wanted to use boost::thread in my program, but get the following compiler error
I am using the following program for sending email through Java. When I use
I use the following program for creating JTable using java class. If I get
I'm using GHCi 7.0.3 with the following program that implements type-level list: {-# LANGUAGE
The following program shows that we can use return or pthread_exit to return a
When I try to use SDL in my c++ program, I get the following:
I use the following to get a list of project files that need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.