J
jonck
Hi all,
I was fiddling around with RMI, got it working, and then all of a
sudden things stopped working. My main class is as follows (it's an
example from a book):
import java.io.Serializable;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class RatingServer extends UnicastRemoteObject implements
RatingServerInterface, Serializable {
public RatingServer() throws RemoteException {
super();
System.out.println("Entering 0-argument constructor");
}
public int serverRating(MovieInterface m) throws RemoteException {
System.out.println("RatingServer asked for a rating");
int s = m.getScript();
int a = m.getActing();
int d = m.getDirection();
return 3 * Math.max(Math.max(s, a), d);
}
public static void main(String args[]) {
try {
Naming.rebind("//localhost/ratingService", new
RatingServer());
System.out.println("Rating server connected to server");
} catch (RemoteException e) {
System.out.println("Ratingserver exception: " + e);
} catch (MalformedURLException e) {
System.out.println("Ratingserver exception: " + e);
}
}
}
I tried reverting back to the state where things still worked (returned
to the exact code as it is mentioned in my book, this code worked
earlier on), but now all of a sudden whenever I tried running my class,
I got the following exception:
Ratingserver exception: java.rmi.ServerException: RemoteException
occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException: RatingServer_Stub
Now I know that this would indicate that RatingServer_Stub cannot be
found, but it's on my classpath (same directory! And this exact setup
worked a few minutes back.
What I think caused all my problems was that during a certain launch,
the 0-argument constructor kept getting called, over and over again. In
fact, it did not stop untill I rebooted my computer. After the reboot
things stopped working.
So my guess is that somehow rmiregistry got screwed up. Could someone
tell me how I could go about re-installing it? I'm on OS X 10.3.7.
Thanks very much for any help, Jonck
I was fiddling around with RMI, got it working, and then all of a
sudden things stopped working. My main class is as follows (it's an
example from a book):
import java.io.Serializable;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class RatingServer extends UnicastRemoteObject implements
RatingServerInterface, Serializable {
public RatingServer() throws RemoteException {
super();
System.out.println("Entering 0-argument constructor");
}
public int serverRating(MovieInterface m) throws RemoteException {
System.out.println("RatingServer asked for a rating");
int s = m.getScript();
int a = m.getActing();
int d = m.getDirection();
return 3 * Math.max(Math.max(s, a), d);
}
public static void main(String args[]) {
try {
Naming.rebind("//localhost/ratingService", new
RatingServer());
System.out.println("Rating server connected to server");
} catch (RemoteException e) {
System.out.println("Ratingserver exception: " + e);
} catch (MalformedURLException e) {
System.out.println("Ratingserver exception: " + e);
}
}
}
I tried reverting back to the state where things still worked (returned
to the exact code as it is mentioned in my book, this code worked
earlier on), but now all of a sudden whenever I tried running my class,
I got the following exception:
Ratingserver exception: java.rmi.ServerException: RemoteException
occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException: RatingServer_Stub
Now I know that this would indicate that RatingServer_Stub cannot be
found, but it's on my classpath (same directory! And this exact setup
worked a few minutes back.
What I think caused all my problems was that during a certain launch,
the 0-argument constructor kept getting called, over and over again. In
fact, it did not stop untill I rebooted my computer. After the reboot
things stopped working.
So my guess is that somehow rmiregistry got screwed up. Could someone
tell me how I could go about re-installing it? I'm on OS X 10.3.7.
Thanks very much for any help, Jonck