使用RMI时抛出 error during JRMP connection establishment; nested exception is:java.io.EOFException] 我自己知道是什么原因了~~~哈哈 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package chapter11; import java.rmi.*; import javax.naming.*; import java.util.*; public class SimpleServer { static Context namingContext = null; public static void bind(String name,HelloService object){ Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL, "t3://localhost:7001"); try{ namingContext = new InitialContext(ht); namingContext.rebind(name,object); }catch(NamingException e){ e.printStackTrace(); }finally{ try{ namingContext.close(); }catch(Exception e){ e.printStackTrace(); } } } public static void main(String args[]){ try{ HelloService service1 = new HelloServiceImpl("service1"); HelloService service2 = new HelloServiceImpl("service2"); bind("HelloService1",service1); bind("HelloService2",service2); System.out.println("the server has registered two HelloService Object"); }catch(Exception e){ e.printStackTrace(); } } } 问题出在以下地方bind("rmi://localhost:7001/HelloService1",service1); bind("rmi://localhost:7001/HelloService2",service2); 当不使用rmiregistry,使用weblogic或Jboss时候不需要指定rmi、地址和端口,因为之前的用InitialContext已指定定好了。-------没想到两个月的复杂中自己想到了原因,哈哈 Neatbean的一个小BUG[求助】 类加载器? 再续Tinking in java 经典题修改后疑问? java中add.list()的问题 面试20分钟让写出来,请教大家! 能不能从html或javascript中触发applet的事件 如何修改Jubilder中,以常规方式编写程序 android应用程序执行shell脚本 vaj for linux 怎样在linux下安装 面试被问到“说出你最不喜欢的java特性,并给予原因”。。。一下子被问到了。。。不知道怎么回答。 Junit使用问题 关于链接数据库,请牛人指教下
package chapter11;
import java.rmi.*;
import javax.naming.*; import java.util.*;
public class SimpleServer {
static Context namingContext = null;
public static void bind(String name,HelloService object){
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://localhost:7001"); try{
namingContext = new InitialContext(ht);
namingContext.rebind(name,object);
}catch(NamingException e){
e.printStackTrace();
}finally{
try{
namingContext.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
public static void main(String args[]){
try{
HelloService service1 = new HelloServiceImpl("service1");
HelloService service2 = new HelloServiceImpl("service2"); bind("HelloService1",service1);
bind("HelloService2",service2); System.out.println("the server has registered two HelloService Object");
}catch(Exception e){
e.printStackTrace();
}
}
}
问题出在以下地方
bind("rmi://localhost:7001/HelloService1",service1);
bind("rmi://localhost:7001/HelloService2",service2);
当不使用rmiregistry,使用weblogic或Jboss时候不需要指定rmi、地址和端口,因为之前的用InitialContext已指定定好了。
-------
没想到两个月的复杂中自己想到了原因,哈哈