HelloClient.class
HelloWorld.class
HelloWorldBean.class
HelloWorldBean_79kcn4_EOImpl.class
HelloWorldBean_79kcn4_HomeImpl.class
HelloWorldBean_79kcn4_Impl.class
HelloWorldHome.class
全部拷贝到客户端原来的HelloClientclient代码你需要做如下的改动。
改成
Properties env = new Properties();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(javax.naming.Context.PROVIDER_URL,"iiop://yourjiqiming:port");
//javax.naming.Context initContext=new javax.naming.InitialContext(env);
Context initContext = new InitialContext(env); Object obj=initContext.lookup("HelloWorld"); //远程查找,由名字得到对应的对象。
RemoteHome home=(RemoteHome)javax.rmi.PortableRemoteObject.narrow(obj,RemoteHome.class);
RemoteInterface remote=home.create();
String receiveFromRemote=remote.message("Hello,Remote Object!"); //远程方法调用
System.out.println("Client Received From Remote Object: \""+receiveFromRemote+"\"");
重新编译javac *.java成功后。把这个新的类copy到其他的机器上
打入java -classpath %J2EE_HOME%\lib\j2ee.jar;.;HelloWorldClient.jar; Client
HelloWorld.class
HelloWorldBean.class
HelloWorldBean_79kcn4_EOImpl.class
HelloWorldBean_79kcn4_HomeImpl.class
HelloWorldBean_79kcn4_Impl.class
HelloWorldHome.class
全部拷贝到客户端原来的HelloClientclient代码你需要做如下的改动。
改成
Properties env = new Properties();
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(javax.naming.Context.PROVIDER_URL,"iiop://yourjiqiming:port");
//javax.naming.Context initContext=new javax.naming.InitialContext(env);
Context initContext = new InitialContext(env); Object obj=initContext.lookup("HelloWorld"); //远程查找,由名字得到对应的对象。
RemoteHome home=(RemoteHome)javax.rmi.PortableRemoteObject.narrow(obj,RemoteHome.class);
RemoteInterface remote=home.create();
String receiveFromRemote=remote.message("Hello,Remote Object!"); //远程方法调用
System.out.println("Client Received From Remote Object: \""+receiveFromRemote+"\"");
重新编译javac *.java成功后。把这个新的类copy到其他的机器上
打入java -classpath %J2EE_HOME%\lib\j2ee.jar;.;HelloWorldClient.jar; Client
解决方案 »
- java 异常(求教)?
- 请教一个displaytag的问题
- 紧急求助一个问题 10061问题---100分求解
- 怎样用JSP实现下面的功能?
- j2ee初级问题!~!
- Validator启用自定义规则客户端验证的问题以及ValidateWhen的资料
- 请问在JAVA中如何替换、修改、扩展XML的内容!
- 官网没有tomcat5.0.24下,高分求下载地址!
- 高手赐教!Tomcat4.02的配置,不知javaBean目录、servlet目录该如何配置?
- 关于EJB中BMP的中文问题???
- 一个简单CMP例子,实现了1:1,1:n,m:n关联,使用xdoclet生成相关文件,在JBoss-3.0.4下运行正常。
- 有谁对JMS了解????送分!!
打入java -classpath %J2EE_HOME%\lib\j2ee.jar;.;HelloWorldClient.jar; Client这是做什么???