HDFS is running on OS X and this simple app runs fine on the same OS X.

But if I move this jar to a Windows machine and run it there, I get into 
ConnectionException.

I can browse http://OSXMachine:50<http://.....:500570>070/ from Windows machine 
fine.

hadoop-2.6.4 is used with Oracle JDK 1.8.0_92.


public static void main(String[] args) throws IOException, 
InterruptedException, URISyntaxException {?

    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(new URI("webhdfs://kyunam.esri.com:50070"), 
conf, "you");

    fs.mkdirs(new Path("TEST1"));
    fs.createNewFile(new Path("TEST2/test.txt"));   // <-- fails here
  }


Exception in thread "main" java.net.ConnectException: Connection refused: connec
t
        at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.<init>(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Sou
rce)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
ce)
        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.connect(W
ebHdfsFileSystem.java:580)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.connect(W
ebHdfsFileSystem.java:537)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.runWithRe
try(WebHdfsFileSystem.java:605)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.access$10
0(WebHdfsFileSystem.java:458)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner$1.run(Web
HdfsFileSystem.java:487)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Unknown Source)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInforma
tion.java:1656)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem$AbstractRunner.run(WebHd
fsFileSystem.java:483)
        at org.apache.hadoop.hdfs.web.WebHdfsFileSystem.create(WebHdfsFileSystem
.java:1139)
        at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:908)
        at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:889)
        at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:851)
        at org.apache.hadoop.fs.FileSystem.createNewFile(FileSystem.java:1151)
        at Main1.main(Main1.java:52)?

Any help is appreciated.

Thanks,
Kyunam

Reply via email to