First of all I want to say hello to everyone (so - Hello!! ). This is my first post on this forum and it`s actually my first Java related forum that I registered in ever. I hope to spend some quality time over here. ;) I have a tendency to write very long first post in a topic so I hope you will manage to get to the end but back to the topic.
Currently I`m writing my engineer thesis and I`ve been reading for the last few days about RMI-IIOP architecture which I need to discuss. I have opened a tens of tabs in my Firefox and there I have a whole bunch of articles and specifications. I feel like my brain can blow up at any time. I hope you can help me to resolve my deep doubts about RMI-IIOP. It would be great if you could answer at least one my question. Please confirm if my way of thinking is correct.
An example of creation process of RMI-IIOP client and server side:
Server side 1) Creating a so called remote interface which extends javax.rmi.Remote interface all methods must throw a java.rmi.RemoteException.
2) Creating a class of our remote object which implements our remote interface.
3) Creating a stub and tie of remote object.
4) Running an Object Request Broker (orbd.exe) which will also run COS Naming Service.
5) Registering of remote object:
a] by using javax.rmi.PortableRemoteObject exportObject() method,
b] by extending PortableRemoteObject by it (then a creation of remote object will effect in invoking of PortableRemoteObject constructor where will be invoked exportObject() method).
6) Configuring JNDI by jndi.properties file or by passing right arguments (java.naming.factory.initial and java.naming.provider.url parameters - the provider url need to be the same as ORB ip adress and port) to the javax.naming.InitialContext constructor to handle the COS Naming Service.
7) Binding the remote object reference with picked name by calling the InitialContext bind() or rebind() method.
Client side 8) Providing to the client the remote interface of our remote object.
9) Configuring JNDI by the same as on the server side jndi.properties file or right arguments in InitialContext constructor.
10) Connecting with remote object by invoking the InitialContext lookup() method with argument which has to be the name of our remote server object.
11) Casting obtained reference to remote interface using PortableRemoteObject narrow() method.
Hopefully that's all.
That was a quite brief introduction to RMI-IIOP implementation and here are my questions:
1] Didn't I omit anything important in my example of creation process? I`m only checking...
2] I read that "somewhere" in RMI-IIOM results are passed by reference instead of by value? Where is it and how come? If I recall correctly Java is a strictly pass by value language, am I right?
3] I haven't checked it yet. Is it possible to create a stub and tie from remote interface instead of remote object and is it going to work?
4] I'm wondering is it abligatory to create a stub and tie class before registering/exporting the remote object?
5] What do we mean by registering the remote object?
6] The specification says exportObject() method "Makes a server object ready to receive remote calls" I understand that's some thought abbreviation? How object can receive remote calls...? (I guess it has something in common with ORB but that?)
7] I read somewhere that by invoking InitialContext bind() or rebind() method we actually don`t bind name to the remote object reference but to the stub of this object and somewhere else I read that we bind the remote object reference with the name but client looking up for the name receive reference to its stub so where the truth lies?
8] I need to confirm something. I'm sure that looking up for the remote object returns the stub object but I didn't provide the stub class to the client so how is that possible that I didn't received some exception like No Class Definition Found Exception (of course I casted it to some other type like object or remote interface type)? I also read that client need to have a stub class so...? That's really confusing.
9] I quite don't get one thing (or rather another thing). I read (yeah I know, I had a lot of reading lately ;)) that marshalling and unmarshalling is done by stub and tie in the other source I read that it's provided by ORB so how it really looks like?
10] How the communication between client and server looks? It's that correct that stub "speaks to" tie and tie invokes the method on remote object? How tie obtains the remote object reference and where is the place for ORB in this communication?
11] Client communicates with server by IIOP so I guess there is an implementation of IOR in Java and this is how a client can localize a server, am I right? Am I correct that stub and tie stores the information about localization of each other? If that's true then when exactly stub obtains this information?
12] Is that true that ORB provides persistence to remote objects? So if the server is offline remote object is still alive and can receive the RMI calls?
13] I know that COS Naming bind remote object reference with name and this service is launched on the same port as ORB (that`s correct, isn`t it?) but I also read that remote objects are exported to some ports so what does it mean?
Okey now I'm sure that my brain is going to blow up, hehe. This is my the longest post in English ever (sorry for probably a lot of language mistakes) and there is a high possibility I forgot to write about some other stuff that I don't know or I'm not sure about. Thank you very much for your patient and, I hope, your help.
Joined: Jan 31, 2011
Hey guys and (probably) girls. It's hard to believe that no one manage to help me answering for at least one of above questions. It's quite disappointing... I hope I'll find here someone with good will who will show me right direction.
I suggest that you purchase a few books about the topic and study the material. Simple question/answer material on an Internet forum is not a replacement for dedicated reading, concentration and study. If you are serious about learning this material then you should invest more time and study the material that authors have published.
Simple question/answer material on an Internet forum is not a replacement for dedicated reading, concentration and study.
I'm copletely agree with you but the heart of the matter is I have to do few different things at the same time not metioned about my job. Sooner or later I'll probably need to look up some new books but I had hoped that earlier I'll find some answers over the Internet. Human brain is such a great repository and it's faster and easier to use someone's knowledge than looking for information often wasting a lot of time founding nothing vauleable.
Joined: Apr 16, 2008
There is a huge difference between "finding answers" and "learning."
Trying to "learn" via disconnected web articles and specification documentation is problematic and when accomplished typically only provides a weak cursory understanding that eventually fades away with time. Moreover, not all information on web page articles and forum responses is correct. There are many wrong "answers" and incorrect explanations on the Internet. If you limit yourself to this style of "learning", how do you ensure that what you are reading is correct? It is not possible.
Material that is published by reputable book publishers and authors is edited for form, accuracy, language, and is prepared in a manner that is conducive to real "learning", not webpage traffic or advertising revenues.
Joined: Jan 31, 2011
Can't argue with that - been there seen that. But I'm still hoping to find some answers over here and verify them with other sources.
Joined: Apr 16, 2008
Sounds good !
Many years ago I took a 4-day course on Java RMI. Each day we met for seven hours and the teacher was fantastic. As a result, today I could easily provide detailed answers to ALL of your questions. However, I feel that I would be cheating you out of a learning experience and I certainly wouldn't want to do this.
Again, "finding answers" and comparing them against other "answers" in isolation is not a prodcutive way to learn deeply. Buy a book today!
3) No it's not possible to create a stub and skel from remote interface. It's required remote object to create.
4) If your JDK is over 1.4 then you do not need to create stub and skel for your remote object otherwise you have to. But you can also create in JDK1.5 or 6. It'll only create stub. Basically in Java6 doesn't need to create stub. It's dynamically create stub of remote object.
5) Registering a remote object means it's bind with the rmiregistry so that client will able to connect with the RMI server and get that remote object through a rmi service name or IP/port.
6) You can export by calling super() from your remote class contructor or by exportObject() method. If you use super() then you need to extends UnicastRemoteObject of your remote class. This export is allow of your remote object to receives clients remote calls. Also if server needs to send a callback notification to a specific client then client also needs to export his/her client object. Otherwise it wont able to receives call from server.
7) Well it vary on your client and server JDK version. If server uses JDK lower than 1.5 then during binding of remote object it's required stub. So if you bind stub then oviously client will lookup stub. If you use JDK1.5 or Java6 then you don't need to bind stub strictly. You can bind remote reference.
8) If your server and client program are running on same machine then client will eventually get stub from that class directory. But if your client and server program runs on different machine then oviously you need to provide stub class to client or client have to dynamically download stub class from server through http or ftp by defining URL in -Djava.rmi.server.codebase=http://<...>
So there are so far. I'll come to you later for rest of the answers.
Joined: Jan 31, 2011
Thanks for your answers Mir Mohammed Easin. Though, I think that in some cases you mixed up the RMI JRPC with RMI IIOP architecture. Now I don't have time to move back to RMI related topics but if I find some time for that I will try to answer my own questions in this topic.