views:

165

answers:

2

Hi, I have an RMI program which runs fine on my computer, but when I run it on my schools computer I get a ClassNotFoundException for my class that is extending Remote. I've looked at some similar questions, my errors are almost identical, but the solutions offered there are not working for me. I can't pass arguments to RMI registry because it is already running and is shared with other students. I tried setting the system.property inside of my program, but that didn't help. I also tried using rmic but that didn't work either.

Here is my error message from Exception.getMessage():

Server exception: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: chordNode

These are the questions with the same type of problem.

http://stackoverflow.com/questions/1507698/rmi-class-can-not-found-exception

http://stackoverflow.com/questions/464687/running-rmi-server-classnotfound

A: 

java.lang.ClassNotFoundException: chordNode

Looks to me like the class "chordNote" is not in the classpath. Is that yours? If it is, you should know that it's a bad idea to use the default package and your class name doesn't follow the usual Java naming conventions. Both are bad signs to me.

It's difficult to tell precisely what's wrong, since you don't post any code.

But since you're a student, I'd suggest that you start fresh with your approach to this problem. When people says things like "It runs fine on this machine, but not on that one", it tells me that they're depending on certain conditions being true that they might not fully understand:

I can't pass arguments to RMI registry because it is already running and is shared with other students.

So is this a shared computer you're trying to deploy your RMI service to? I'd speak to the owner of the server and RMI repository to see how you can get your code deployed there.

Or you can start your own instance that listens on another port besides the default.

I tried setting the system.property inside of my program, but that didn't help.

I'm sorry, what system property do you mean?

I also tried using rmic but that didn't work either.

Why would you need to run rmic if you're moving code from one computer to another?

What does "didn't work" look like? Maybe the path isn't set properly.

Sorry, your question is too vague to answer.

duffymo
A: 

The problem was using an rmiregistry that was launched by another user. This meant that the classpath being used by the rmiregistry was based on another users environment. To fix this, I launched my own rmiregistry on another port.

James