• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

headache of rmiregistry

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, guys
I encountered a problem: I cant bind my remote object to the rmiregistry service.
My working steps is as follows:
1) In the current directory (let's suppose it is D:\\server\) I created the remote object class -
DataImpl(certainly there's also the remote interface), in its main method, I wrote the code:
try
{
DataImpl di = new DataImpl();
Naming.rebind("test", di);
}
catch(Exception e)
{
System.out.println(e);
}
2) run the javac to create the .class files: javac *.java.
I found all the .class files are correctly created in the directory.
3) rum the rmic to create the stub class: rmic -v1.2 DataImpl.
I found the expected DataImpl_Stub.class is also correctly created in the directory.
4) from c:\\ run the rmiregistry: rmiregistry
I made the directories different intentionally for i assumed they are not necessarily to be the same.
5) as I hava no HTTP Server installed in my pc, i intended to use file protocol for the
java.rmi.server.codebase property.
I made the "D:\\server\" directory sharable and it's sharing name is "server"
6) from D:\\server\ (where the DataImpl and its stub class reside) run the java:
java DataImpl -Djava.rmi.server.codebase="file://James/server/"
("James" is the name of my pc)
It reported RemoteException and its nested Exception is UnmarsalExcepton and its nested Exception is
ClassNotFoundException: DataImpl_Stub.
Anyone has some clues? if I use file protocol, do i also need to use sth like a File Server to service the incoming request? I assumed my Win98 has the built-in service and could do it automatically, for i could see the contents of the directory from other pc using "file://james/server/".
In the step 4), if i started the rmiregistry from "D:\\server\", it works even without the codebase property, how strange!

How rmiregistry get to know the location of the registried objects? I think the codebase propery specifies not only the location of the remote object but also the protocol the clients could require the stub, if no protocol given, In which way clients could download the stub class? the problem really drives me nuts!
Any reponse and analyse is greatly appreciated
Thanks in advance
- James Du
[ March 09, 2002: Message edited by: James Du ]
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, it's still me.
I found a mistake in the step 6), that's the commandline : java DataImpl -Djava.rmi.server.codebase="file://James/server/" is wrong, the codebase property must go before DataImpl or JVM will take the property as null.
So, I changed the commandline as
java -Djava.rmi.server.codebase="file://James/server/" DataImpl. But it still dont work
I'm wondering if the codebase property is a must for running RMI application
- James
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have encountered a simliar problem, though not exactly as you had described.<br>It turns out that I have multiple JVM's installed in my machine. When I typed "rmiregistry", an earlier version (of JDK1.1) got started instead of (JDK1.3). And when I start the application, I get the message of stub class not found.<br>So you could try starting your rmi registry with command "c:\jdk1.3\bin\rmiregistry" and your application with command "c:\jdk1.3\bin\java ...". The same goes for "rmic". This way, you will know exactly what version you are using.
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Hai Yee.
I kept trying and trying various parameters combination and happened to come across the solution, the key lies in the URL format, i changed the codebase property as file:/d:\server/ rather than file://James/server/ and it do worked!
And then i tried my client, it turned out that there must have an entry as

permission java.io.FilePermission "d:\\server\\-", "read";


in the policy file for client to download the stub class.
There arised the new problem: How does it work if the server and the client are in the different machine
Or maybe RMI does not support it at all?
-James
 
reply
    Bookmark Topic Watch Topic
  • New Topic