Server IPC version 9 cannot communicate with client version 4

qq_30118615 2017-06-20 05:57:03
org.apache.hadoop.ipc.RemoteException: Server IPC version 9 cannot communicate with client version 4
org.apache.hadoop.ipc.Client.call(Client.java:1107)
org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
com.sun.proxy.$Proxy5.getProtocolVersion(Unknown Source)
org.apache.hadoop.ipc.RPC.getProxy(RPC.java:411)
org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:135)
org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:276)
org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:241)
org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:100)
org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1411)
org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:66)
org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1429)
org.apache.hadoop.fs.FileSystem.get(FileSystem.java:254)
com.model.HdfsDAO.ls(HdfsDAO.java:70)
com.controller.LoginServlet.doPost(LoginServlet.java:47)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


note The full stack trace of the root cause is available in the Apache Tomcat/7.0.78 logs.


我使用的是hadoop2.8.0版本,工程里面引入的lib 是hadoop1.1.2版本里的包,然后我在连接hdfs的时候 它就报这个错误。




Path path = new Path(folder);
FileSystem fs = FileSystem.get(URI.create(hdfsPath), conf);
FileStatus[] list = fs.listStatus(path);
System.out.println("ls: " + folder);
System.out.println("==========================================================");
if(list != null)
for (FileStatus f : list) {
//System.out.printf("name: %s, folder: %s, size: %d\n", f.getPath(), f.isDir(), f.getLen());
System.out.printf("%s, folder: %s, 大小: %dK\n", f.getPath().getName(), (f.isDir()?"目录":"文件"), f.getLen()/1024);
}
System.out.println("==========================================================");
fs.close();

return list;


错误源码在这里,经过调试就是这一句连接是报错 FileSystem fs = FileSystem.get(URI.create(hdfsPath), conf);
想请问一下如何解决
...全文
766 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

932

社区成员

发帖
与我相关
我的任务
社区描述
云计算 云存储相关讨论
社区管理员
  • 云存储
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧