wood burning stoves 2.0
The moose likes Distributed Java and the fly likes Location of stub and Remote Interface...Urgent pls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Location of stub and Remote Interface...Urgent pls" Watch "Location of stub and Remote Interface...Urgent pls" New topic

Location of stub and Remote Interface...Urgent pls

Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
In my rmi-iiop call to a remote server I have placed the stb class and the Remote interface class along with the client and I am able to complete the call successfully.
my question is that do I really need to place the remote interface with the client and Stb classes.
If I try to remove the remote interface from the client directory then it gives me an error saying that "Remote Interface is not found.
I thought that the remote interface need not be with the client and the stb class.
please clarufy on this if I am wrong i.e. do i really need the remote interface with the client in order to make the rmi-iiop call.
Thanks and regards

maateen ashraf
Ranch Hand

Joined: Jan 08, 2001
Posts: 122
u only need to download stub file on client machine
remote interface shouldn't be downloaded on client machine
Naming class will itself find the refrence of remote object itself from stub on client
i think it will help u
other wise feel free to ask about problem if it still exists.
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
I have tried removing the Remote Interface from the client machine but the code did not compile giving me the error "myInterface class not found" in the line when i cast to it using PortableRemoteObject.
Pls help if I am wrong somewhere.
I have bounded the remote object as ;
MyImplementation abc=new MyImplementation()
also i am casting in the following way;
MyInterface xyz=(MyInterface)PortableRemoteOPbject.narrow(objref,MyInterface.class);
Please e know as to why am i not able to compile the Client without having the remote interface on its side.
Thanks and Regards

Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
please help me

Joined: Jan 28, 2001
Posts: 21
if you want sperate your client application with stub, there a couple of things you need to do.
First, in server side, make sure where is stub location. in a jar or in class pacakge or just in a directory, which is not related any packages.
Second, every time you start the server, you should refer this location to the rmi.server by following syntex commands:
java -Djava.rmi.server.codebase=file:/c:\your firl location
check for this to see if you can get it or not.
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
Dear all,
Thanks for your response but as suggested by David I alwaiys start the server with the -D java.rmi.codebase property which holds the URL where my Stub is.
Yet now if I remove the RemoteInterface from the directory where my client is (on a separate machine) I am not able to compile the client and it still gives me an error in the line where I cast the remote reference to the RemoteInterface. It says "class 'remoteinterface not found' ".
Please throw some more light o this as I also believe that the remote interface should not be present with the client and should be reference remotely through the stub but my client fails to compile if I dont include it in the Client's directory.
Pls reply to me urgently!!!
Sagar Sharma
Ranch Hand

Joined: Aug 31, 2000
Posts: 92
Pls reply urgently!!!
Suneel Setlur
Ranch Hand

Joined: Nov 26, 2000
Posts: 202
Remote interfaces define methods which need to be implemented.
If you remove the remote interface and then compile(as you mentioned) definitely you will get errors.
Keep the remote interfaces while compiling and later remove it and try to run the program.

sanjays samadder

Joined: Mar 30, 2001
Posts: 24
let me share my experience with you regarding the problem I too faced
I tried to compile the client programe in adifferent machine.surely it did not recognise the interface .
then i compiled it in the same directory as the interface.
i put both the client class and the interface class in
a different machine.
I work in a network evironment .
and use dhcp server which assigns dynamic ip addresses .
so the client programe sometimes worked and at times it did not .this was as i discovered due to the ever changing ip addresses.
each time i had to remove the clent .class from the client machine and recompile the client .java in the server machine making changes to the ip address.by running the command ipconfig at command promt which gave me the day's ip address for the server machine.
and copied the class file in the other machine.
it worked.
please pass on any info you may stumble upon
I agree. Here's the link: http://aspose.com/file-tools
subject: Location of stub and Remote Interface...Urgent pls
It's not a secret anymore!