java.rmi.ServerException: RemoteException occurred in server thread (ClassNotFoundException)
There are four cases of this exception.
When exporting: you didn't run 'rmic' and you didn't take the steps described in the preamble to the Javadoc for
UnicastRemoteObject
to make it unnecessary.When binding: the Registry doesn't have the stub or the remote interface or something they depend on on its classpath.
when looking up: the client does't have these things on its classpath.
When calling a remote method: you either sent something to the server of a class not present on its CLASSPATH, or received something from the server (including an exception) of a class not on your CLASSPATH: in both cases possibly a derived class or interface implementation of a class or interface mentioned in the remote interface's method signature.
This is case 2. The Registry can't find the named class.
There are several solutions:
Start the Registry with a CLASSPATH that includes the relevant JARs or directories.
Start the Registry in your server JVM, via
LocateRegistry.createRegistry().
Use dynamic stubs, as described in the preamble to the Javadoc of
UnicastRemoteObject.
However you may then still run into the same problem with the remote interface itself or a class that it depends on, in which case 1-3 above still apply to that class/those classes.Ensure that case (4) above doesn't occur.
Use the codebase feature. This is really a deployment option and IMO something to be avoided at the initial development stage.
Why java.rmi.ServerException: RemoteException occurred in server thread shows?
If you look at the entire stack trace, which you should have posted in your question, you will probably find that the error occurred in bind() or rebind(). That indicates that the Registry doesn't have the class mentioned on its CLASSPATH.
Solution: either run the Regsistry with an appropriate CLASSPATH, or run it inside the server JVM via LocateRegistry.createRegistry().
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
Try start the rmiregistry in the command line with the same path you run javac and java.
Java RMI, cant find stub class , java.rmi.ServerException: RemoteException occurred in server thread;
The RMI Registry can't find that class. So there is some difference in your laptop's setup concerning the Registry.
RMI, ServerException: RemoteException
When you start your server application you have to point where RMI should look for classes
you can do it using java.rmi.server.codebase property, so the right command looks like this:
java -classpath "D:\[...]\bin"
-Djava.rmi.server.codebase=file:/D:\[...]\bin/ example.hello.Server
Related Topics
What Is the "Continue" Keyword and How Does It Work in Java
Java 8: Difference Between Two Localdatetime in Multiple Units
Splitting on Comma Outside Quotes
"Code Too Large" Compilation Error in Java
Sorting a Collection of Objects
How to Wire One Pane to Another
Scale the Imageicon Automatically to Label Size
Update Jlabel Every X Seconds from Arraylist<List> - Java
Differences Between Oracle Jdk and Openjdk
Implementing Singleton with an Enum (In Java)
Connecting to Remote Url Which Requires Authentication Using Java
Convert Java.Util.Date to Java.Time.Localdate
Differencebetween & and && in Java