aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI - Transport return code invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI - Transport return code invalid" Watch "RMI - Transport return code invalid" New topic
Author

RMI - Transport return code invalid

Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
Any idea what this means? I am looping 10 times on a RMI call and it gets 2 successfully, then throws this exception. I can't find anything anywhere on it.
java.rmi.UnmarshalException: Transport return code invalid
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at suncertify.rmi.RMIServerImpl_Stub.getDate(Unknown Source)
at suncertify.rmi.RMIClient.main(RMIClient.java:28)
My sample client code:
public static void main(String[] args) {
try{
if(System.getSecurityManager() == null){
System.setSecurityManager(new RMISecurityManager());
}
RMIServerIF serverIF = (RMIServerIF)Naming.lookup("rmi://localhost/MyName");
System.out.println("Object from server is " + serverIF.getName());
for(int i=0; i<10; i++){
System.out.println((serverIF.getDate()).getTime().toString());
}
}catch (Exception e){
e.printStackTrace();
}
return;
}
Thanks!
Paul
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hi Paul, I am assuming this is part of the assignment. I got a doubt regarding the use of security manager. My instructions specifically states:

You must not require the installation of a security manager.

I'm don't know much about RMI. So, does it mean we have to use security manager at the client side. It seems that you have used it at the client right. Can you help me understand the reason for using security manager?
Appreciate your help, Thanks.
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
I have used the security manager because I am getting socket permission errors if I don't. My assignment is old - and probably a different assignment from yours.
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Paul thanks for clarification. Sorry that I cannot help you as I don't know much about RMI or Sockets.
Thanks.
[ March 09, 2004: Message edited by: Satish Avadhanam ]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11508
    
  95

Hi Paul,
Could you add a sleep statement into your loop and see if it behaves any better then? (Say 1/4 of a second or so). This may just be a timing issue - you are hammering the network to get those 10 calls through.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
Thanks, Andrew. I'll try that! Will let you know if it works.
Paul Smiley
Ranch Hand

Joined: Jun 02, 2000
Posts: 244
Worked like a charm. Good advice!
Changing OS's (ME to XP) and upgrading the J2SDK apparently makes it run faster - therefore the collisions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI - Transport return code invalid