Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI Exception

 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have been stuck on this exception for a long time.
I receive the following exception when I run the client application on a separate PC:
"UnmarshalException - error unmarshiling return Java.Lang.ClassNotFoundException BAdapter_STUB not found"
If I start the client application on the same PC as the server, I do not recieve the exception.
I have verified that the command line 'codebase' variable is accurate. I have verified that the CLASSPATH environment variable is set to null when I start the rmiregistry.
I am developing on Win2000.
Any help would be greatly appreciated.
Thanks,
Tim
 
Doug Melzer
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using -Djava.rmi.server.codebase="..." to specify where the classes should be found.
 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doug,
Thanks for the rely. Here is the command line I have been using for starting the server:
java -Djava.rmi.server.codebase=file:///e:\DATA\Projects\JavaDevCert\scjd\starting\ -Djava.security.policy=c:\java2\jdev\test.policy suncertify.server.RMIServerDBAdapter db.db
I copied and pasted the codebase assignment into Internet Explorer, and it went to the proper directory. Is this a good test?
Do you have any other ideas???
Thanks,
Tim
 
Andras Nemeth
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Originally posted by Tim Lauster:
Doug,
Thanks for the rely. Here is the command line I have been using for starting the server:
java -Djava.rmi.server.codebase=file:///e:\DATA\Projects\JavaDevCert\scjd\starting\ -Djava.security.policy=c:\java2\jdev\test.policy suncertify.server.RMIServerDBAdapter db.db

As far as I know, you do not need three /, two is enough (or sometimes one ). Anyhow, I do not think that this is the root of your problem. When you use URL, like file://, you must close
this url with / (and not with \).
It is working on my computer...
As you might saw I have problem with dynamic class downloading,
I mean not stub, but other classes... Do you plan to use this feature? Do you have any good documents about it?
So long,
Ban
PS: See the Dynamic downloading thread also...
 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andras,
Thanks for the reply.
I changed my codebase to reflect your suggestions:
java -Djava.rmi.server.codebase=file:/e:\DATA\Projects\JavaDevCert\scjd\starting/ -Djava.security.policy=c:\java2\jdev\test.policy suncertify.server.RMIServerDBAdapter db.db
I am still receiving the following exception:
Exception: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: suncertify.server.RMIServerDBAdapter_Stub
Do you have any other suggestions? Are there any logs created to verify that the RMI is at least attempting to connect?
Thanks in advance,
Tim
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the service interface available from your web server along with the stub?
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,
Thanks for the reply. I am not framiliar with the web server's 'service interface'? I am running Win2000 with IIS 5.0. What should I be looking for?
For anyone else that is having similar RMI issues, check these links out: http://java.sun.com/products/jdk/1.2/docs/guide/rmi/faq.html http://java.sun.com/products/jdk/1.2/docs/guide/rmi/codebase.html
Any other suggestions???
Thanks.
[This message has been edited by Tim Lauster (edited August 22, 2001).]
 
Andras Nemeth
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Lauster:
Andras,
Thanks for the reply.
java -Djava.rmi.server.codebase=file:/e:\DATA\Projects\JavaDevCert\scjd\starting/ -Djava.security.policy=c:\java2\jdev\test.policy suncertify.server.RMIServerDBAdapter db.db
I am still receiving the following exception:
Exception: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: suncertify.server.RMIServerDBAdapter_Stub

Hi Tim,
Did you try with two / too?
What is your directory when you execute the above command?
Is your stub file e:\DATA\Projects\JavaDevCert\scjd\starting\suncertify\server\RMIServerDBAdapter_Stub?
What is in your policy files? Where do you use policy?
On my computer it does not matter if I set a wrong codebase, the server will start, only the client get exception. As I see, you got class not found at server. :O
my server command is:
java -Djava.security.policy=./grantall.policy -Djava.rmi.server.codebase=http://anemeth/examples/classes/ suncertify.db.RemoteServer
client:
java -Djava.security.policy=./suncertify/client/grantall.policy suncertify.client.RemoteDataClient anemeth
grantall.policy:
grant {
// Allow everything for now
permission java.security.AllPermission;
};
Well, that's all what I can think now.
Hopefully you will go further.
Ban
 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andras,
Thanks for the reply.
During my debugging efforts I have made a few changes. Here is the latest setup that I am using:
test.policy:
grant {
// Allow everything for now
permission java.security.AllPermission;
};
server command line:
java -Djava.rmi.server.codebase="http://myhttpserver/server.jar" -Djava.rmi.server.logCalls=true -Djava.security.policy=c:\java2\jdev\test.policy suncertify.server.RMIServerDBAdapter db.db
I have verified the codebase entry by downloading the server.jar through IE on both the server and the client PCs.
client command line:
java -Djava.security.policy=c:\Data\Starting\test.policy ClientTest
I have tried a number of different combinations of the above, but I still recieve the same exception. The only success I have had is when I place a copy of the STUB on the client PC.
My next plan of attack is to download the code from the Sun RMI tutorial and see if I can get that to run. I'll let you know how that turns out.
Thanks again for the continued suggestions.
 
Tim Lauster
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
First off, I would like to thank everyone that has responded to my posts. Your insights and suggestions were truly appreciated.
As you might have expected, the error turned out to be pretty silly. I did not have the current working directory in my classpath. I made the assignment, and now everything is working great.
Thanks again,
Tim

[This message has been edited by Tim Lauster (edited August 23, 2001).]
[This message has been edited by Tim Lauster (edited August 23, 2001).]
 
Daniel Wu
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Lauster:
I did not have the current working directory in my classpath.

Hi Tim,
Could you please elaborate a bit the procedure you put your current working directory in your classpath? Also did you check out your classpath on Windows by running AUTOEXEC.bat file, or other ways? Thank you for your reply.
Daniel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic