rmi

RMI Server Exception

江枫思渺然 提交于 2019-12-01 06:25:14
问题 I am getting below exception from RMI when I try to run a Server which uses a remote registry. My registry cod for the main method in Server2 class is Registry registry = LocateRegistry.getRegistry("192.168.1.4",1100); registry.rebind("Hello",stub); 192.168.1.4 is another machine in the same LAN. Please help me. Server2 exception:java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested

Java RMI那点事儿:初识HelloWorld

一世执手 提交于 2019-12-01 04:59:59
Java RMI 指的是远程方法调用 (Remote Method Invocation)。它是一种机制,能够让在某个 Java 虚拟机上的对象调用另一个Java 虚拟机中的对象上的方法。可以用此方法调用的任何对象必须实现该远程接口。 Java RMI不是什么新技术(在Java1.1的时代都有了),但却是是非常重要的底层技术。 大名鼎鼎的EJB都是建立在rmi基础之上的,现在还有一些开源的远程调用组件,其底层技术也是rmi。 在大力鼓吹Web Service、SOA的时代,是不是每个应用都应该选用笨拙的Web Service组件来实现,通过对比测试后,RMI是最简单的,在一些小的应用中是最合适的。 下面通过一个简单的例子来说明RMI的原理和应用,下面这个例子是一个简单HelloWorld,但已涵盖RMI的核心应用与开发模式。 package com.jason.rmi; import java.rmi.Remote; import java.rmi.RemoteException; public interface Hello extends Remote{ public String sayHello() throws RemoteException; public String sayHelloToSomeOne(String someOneName) throws

Java RMI之HelloWorld篇

末鹿安然 提交于 2019-12-01 04:59:48
Java RMI 指的是远程方法调用 (Remote Method Invocation)。它是一种机制,能够让在某个 Java 虚拟机上的对象调用另一个 Java 虚拟机中的对象上的方法。可以用此方法调用的任何对象必须实现该远程接口。 Java RMI不是什么新技术(在Java1.1的时代都有了),但却是是非常重要的底层技术。 大名鼎鼎的EJB都是建立在rmi基础之上的,现在还有一些开源的远程调用组件,其底层技术也是rmi。 在大力鼓吹Web Service、SOA的时代,是不是每个应用都应该选用笨拙的Web Service组件来实现,通过对比测试后,RMI是最简单的,在一些小的应用中是最合适的。 运行RMI服务端程序: 运行RMI客户端程序: 总结: 从上面的过程来看,RMI对服务器的IP地址和端口依赖很紧密,但是在开发的时候不知道将来的服务器IP和端口如何,但是客户端程序依赖这个IP和端口。 这也是RMI的局限性之一。这个问题有两种解决途径:一是通过DNS来解决,二是通过封装将IP暴露到程序代码之外。 RMI的局限性之二是RMI是Java语言的远程调用,两端的程序语言必须是Java实现,对于不同语言间的通讯可以考虑用Web Service或者公用对象请求代理体系(CORBA)来实现。 下面通过一个简单的例子来说明RMI的原理和应用,下面这个例子是一个简单HelloWorld

Java RMI cannot bind server

旧街凉风 提交于 2019-12-01 04:16:41
I'm working on Java RMI application, and having problem binding a server to the registry. I'm working on eclipse using rmi plugin, and everything worked fine before I had to format my pc. Also, I'm sure the code is ok since it's the one given to me as a solution, so there must be something wrong with my configuration. Here's the code: public static void main (String[] args){ try{ RMIChatServer myObject = new RMIChatServerImpl(); System.setSecurityManager(new RMISecurityManager()); Naming.rebind("Hello", myObject); System.out.println("Remote object bound to registry"); } catch( Exception e){

Is communication in java rmi secure?

妖精的绣舞 提交于 2019-12-01 03:35:34
Is communication between clients and servers in java rmi secure (i.e. encrypted by default)? Encoded, yes. Encrypted, no. JERI for JINI gives JRMP (the RMI protocol) over SSL, IIRC. JSR #76 would have provided RMI Security, however it was controversially voted down . I think you mean "encrypted" not "encoded". The answer is no. If you're using RMI in a non-trusted environment I would suggest something like RMI over SSH tunneling . By secure I guess you mean encrypted. Not by default with RMI. You can use custom socket factories to encrypt RMI comms. In short, no. http://java.sun.com/j2se/1.4.2

Android networking

元气小坏坏 提交于 2019-12-01 02:23:17
问题 We are implementing a sever-client architecture and some of the client apps are supposed to run on android OS. The first idea that came to mind was to use java RMI, but the RMI api is obviously not implemented for android. So 1) Is there a way to use the java RMI api in an android application? Can I just import it from the standard java library? 2) What are the possible substitutes for RMI which will work for both android and desktop applications? Thanks. 回答1: RMI is a bad solution for

Java RMI cannot bind server

血红的双手。 提交于 2019-12-01 01:20:06
问题 I'm working on Java RMI application, and having problem binding a server to the registry. I'm working on eclipse using rmi plugin, and everything worked fine before I had to format my pc. Also, I'm sure the code is ok since it's the one given to me as a solution, so there must be something wrong with my configuration. Here's the code: public static void main (String[] args){ try{ RMIChatServer myObject = new RMIChatServerImpl(); System.setSecurityManager(new RMISecurityManager()); Naming

Is communication in java rmi secure?

女生的网名这么多〃 提交于 2019-12-01 00:52:06
问题 Is communication between clients and servers in java rmi secure (i.e. encrypted by default)? 回答1: Encoded, yes. Encrypted, no. JERI for JINI gives JRMP (the RMI protocol) over SSL, IIRC. JSR #76 would have provided RMI Security, however it was controversially voted down. 回答2: I think you mean "encrypted" not "encoded". The answer is no. If you're using RMI in a non-trusted environment I would suggest something like RMI over SSH tunneling. 回答3: By secure I guess you mean encrypted. Not by

Java RMI - Making the client a server

南笙酒味 提交于 2019-11-30 22:28:58
If i want to enable 'two way' communication in my RMI Application (That is, allow the server to invoke methods on the client, as well as the client to invoke methods on the server), is the simplest way to make the client into a Remote class as well? Also if i intend to pass instances of my client to server as a method parameter, am i correct in thinking that there is no need to add the 'client class' to the rmiregistry? And one final question, do all of my classes still need to be compiled in the same place? I.E can i compile server and client on two entirely independent machines and expect

Determine remote client IP address for Java RMI call

混江龙づ霸主 提交于 2019-11-30 20:58:59
When I implement an RMI server (implement an interface that extends java.rmi.Remote) is there a way to get information about the current RMI request context, specifically the remote client's IP address? public void myMethod() throws RemoteException { log.info("remote IP is "+ RMISomething.getSomething()); } See java.rmi.server.RemoteServer#getClientHost 来源: https://stackoverflow.com/questions/590257/determine-remote-client-ip-address-for-java-rmi-call