The moose likes Distributed Java and the fly likes Problem running RMI on Netbeans 5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Problem running RMI on Netbeans 5.0" Watch "Problem running RMI on Netbeans 5.0" New topic

Problem running RMI on Netbeans 5.0

Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
I am using net 5.0 which uses java 1.5.0_06 version.
Here is what i did
New project
This project has an interface that extends that Remote interface and all the methods in this interface are de
clard to throw a RemoteException.

I have the service class that implements this inteface and its no-arg constructor throws a RemoteException.

And i have a Main class that continst the main method which puts the service class in the rmi registry

When i run the main class i receive the following exception :
emoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: tryrmi.SayHello

I know that java 1.5 autogenerates the stub and skeleton objects.
Anybody can tell me how to solve this problem??

Life is the biggest school
Bod Toki
Ranch Hand

Joined: Sep 01, 2006
Posts: 95
You probably have not exported the object. RMI Objects need to be exported to recieve remote invocations. Two ways I know you can do that:
1. extend java.rmi.server.UnicastRemoteObject - here, the constructor exports the object - the easier method.
2. from somewhere in your code (say your server that makes this remote object available) export the object using static method UnicastRemoteObject.exportObject(theRemoteObject)

guess this should solve the problem. You should read more on RMI if this solves the problem.... you probably need some more understanding of how and why RMI works.

happy coding.
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
I have tryed both of the two methods you mentione but none of them worked.
I have read about RMI and i am sure i am doing all the classes the right way??
I dont know what's the bug??
Khaled Mahmoud
Ranch Hand

Joined: Jul 15, 2006
Posts: 361
I think that the RMI is not supported in NetBeans 5.0
[ October 12, 2006: Message edited by: Khaled Mahmoud ]
I agree. Here's the link:
subject: Problem running RMI on Netbeans 5.0
It's not a secret anymore!