码迷,mamicode.com
首页 > 编程语言 > 详细

bug--java访问hdfs (Server IPC version 9 cannot communicate with client version 4 错误)

时间:2015-11-30 19:59:13      阅读:465      评论:0      收藏:0      [点我收藏+]

标签:

1. 今天想做一个hdfs的java工具类,但是在连接hdfs的时候,报如下错误:

 

Exception in thread "main" org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4
at org.apache.hadoop.ipc.Client.call(Client.java:1113)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:85)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:62)
at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
at org.apache.hadoop.ipc.RPC.checkVersion(RPC.java:422)
at org.apache.hadoop.hdfs.DFSClient.createNamenode(DFSClient.java:183)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:281)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:245)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:100)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1446)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1464)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:263)
at com.dk.hdfs.HdfsDAO.ls(HdfsDAO.java:53)
at com.dk.hdfs.HdfsDAO.main(HdfsDAO.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
 
 
 
找了半天,也没有找到怎么回事,我的hadoop 2.6.0. mav 的配置库都是依赖2.6.0的。可是就是出错
在statckoverflow上也没有给出答案:
最后一个个jar包测验。发现at org.apache.hadoop.ipc.Client.call(Client.java:1113)  这个地方有2个jar包可选
猜测引用jar包有问题.我发现
技术分享
 
hadoop –core这个是唯一不是2.6.0.的估计就是它的问题。然后我就在pom文件中加入如下代码:
 
<dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.6.0</version>

        </dependency>


        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-core</artifactId>
            <version>1.2.0</version>
        </dependency>

问题解决。

 

2.思考

具体不知道什么原因,如果阁下直到原因,请发邮件通知。十分感谢。chaoren399@126.com .

bug--java访问hdfs (Server IPC version 9 cannot communicate with client version 4 错误)

标签:

原文地址:http://www.cnblogs.com/chaoren399/p/5007818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!