windows下开发常见的异常(RPC)
来源:互联网 发布:大数据 云存储 编辑:程序博客网 时间:2024/06/02 06:07
实现RPC通信
首先介绍开发的过程
Linux上进行开发
服务接口
public interface TestInterface {
public static final long versionID = 1L;
public String show();}
服务实现类
public class TestImpl implements TestInterface{
@Override
public String show() {
// TODO Auto-generated method stub
return "abc"; }}
发布服务
public class StartService {
public static void main(String[] args) throws HadoopIllegalArgumentException, IOException {
Configuration conf=new Configuration();
Builder builder=new RPC.Builder(conf);
builder.setInstance(new TestImpl()).setBindAddress("Hadoop").setPort(10000).setProtocol(TestInterface.class);
Server build = builder.build();
build.start();
System.out.println("endpoint success");}}
windows开发客户端
需要复制一份服务接口
public interface TestInterface {
public static final long versionID = 1L;
public String show();}
调用服务方法
public static void main(String[] args) throws Exception {
TestInterface proxy = RPC.getProxy(TestInterface.class, 1L, new InetSocketAddress("192.168.229.128", 10000), new Configuration());
System.out.println(proxy.show());
//访问hdfs文件系统
Configuration conf=new Configuration();
conf.set("fs.defaultFS", "hdfs://192.168.229.128:9000/");
}
最后就是一些常见运行不成功的问题
2016-11-23 21:21:19,511 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(374)) - Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
解决办法 没有找到winutils文件,在网上下载一个对应版本的hadoop-common-2.2.0-bin-master文件,解压之后,配置环境变量,如
HADOOP_HOME E:\大数据\hadoop-2.7.2
Path ;%HADOOP_HOME%\bin
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.createFileWithMode0(Ljava/lang/String;JJJI)Ljava/io/FileDescriptor;
原因:你的bin目录下的hadoop.dll文件和你的正在使用的hadoop jar包不是同一个版本的,
解决办法:在网上下载一个对应版本的hadoop.dll文件替换原来的文件即可
最后补充一点:出错之后,每改动一处之后,重启IDE工具才能生效
- windows下开发常见的异常(RPC)
- 开发常见的异常
- C#开发常见的异常
- 网络负载均衡环境下wsHttpBinding+Message Security+Windows Authentication的常见异常
- 网络负载均衡环境下wsHttpBinding+Message Security+Windows Authentication的常见异常
- 网络负载均衡环境下wsHttpBinding+Message Security+Windows Authentication的常见异常
- VC++ 下windows开发常见数据类型
- Java开发中常见的异常(Exception)
- Java 开发中常见的异常问题
- iOS开发中常见的一些异常
- java开发过程中常见的异常
- windows 下有用的命令(不常见的)
- 异常-常见的异常
- android开发常见异常集(一)
- ssh常见开发异常解决办法(转)
- SWT开发常见异常
- Android开发常见异常
- SWT开发常见异常
- HTML基础加强
- Java基础——多线程编程
- JSTL 标签大全详解
- 控制页面中的表情输出
- 1597: [Usaco2008 Mar]土地购买 斜率优化dp
- windows下开发常见的异常(RPC)
- kafka深度解析
- JSP:include指令与include动作的区别
- i/o流
- 关于强制横或竖屏的坑
- POJ 2456 Aggressive cows 二分答案
- [转] 玩转Eclipse的Wildfly安装、配置到部署
- 总结eclipse中安装maven插件
- 第15章 ByteBuf和相关辅助类