File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes stub not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "stub not found" Watch "stub not found" New topic

stub not found

Diego Rosso

Joined: Mar 04, 2005
Posts: 3
Hi all,

I am finding this problem in the startup of the rmi server.

ReportGeneratorImpl Server failed: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
at sun.rmi.server.UnicastServerRef.oldDispatch(
at sun.rmi.server.UnicastServerRef.dispatch(
at sun.rmi.transport.Transport$
at Method)
at sun.rmi.transport.Transport.serviceCall(
at sun.rmi.transport.tcp.TCPTransport.handleMessages(
at sun.rmi.transport.tcp.TCPTransport$

Could anybody suggest why this is happenning?


public interface ReportGenerator extends Remote {
public String make(
int ReportKey,
int customerId,
int branchId,
int vehileId,
int driverId,
int aggregationId,
String reportName,
String reportType,
java.util.Date iniDate,
java.util.Date endDate
) throws RemoteException; }

public class ReportGeneratorImpl extends UnicastRemoteObject implements ReportGenerator {
protected ReportGeneratorImpl() throws RemoteException { super(); }
public String make( int ReportKey , int customerId , int branchId , int vehileId , int driverId , int aggregationId , String reportName , String reportType , Date iniDate , Date endDate ) throws RemoteException { ReportMaker rm = new ReportMaker();
return rm.make( ReportKey , customerId , branchId , vehileId , driverId , aggregationId , reportName , reportType , iniDate , endDate);

public class ReportServer {
public static void main (String[] argv) {
try {
Naming.rebind("generator", new ReportGeneratorImpl());
System.out.println ("ReportGeneratorImpl Server is ready.");
} catch (Exception e) {
System.out.println ("ReportGeneratorImpl Server failed: " + e.getMessage());
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

B.6 I am getting a ClassNotFoundException for my stub class when I try to register a remote object in the registry. What's happening?

When you make a call to the registry to bind an object, the registry actually binds a reference to the stub for the remote object. In order to instantiate a stub object, the registry VM needs to be able to load its class definition. The VM (in this case the server VM) that sends the serialized forms of a stub in a remote method call to the registry is responsible for annotating the stub with the location from which its classes can be downloaded. If stubs are not annotated properly, Java RMI will throw a ClassNotFoundException when it tries to instantiate the stub.
To annotate classes properly, the server needs to set the value of the java.rmi.server.codebase property value to the location(s) of the stub classes. Java RMI will automatically annotate the serialized form of outgoing object instances with the value of the java.rmi.server.codebase property.

NOTE: It is possible (and in a small number of environments appropriate) to enable the rmiregistry to unmarshal stub objects by placing all relevant stub class files in the CLASSPATH of the rmiregistry. However, the rmiregistry does not have to download stub classes. If stub classes are available locally, it will use those classes. Using the rmiregistry's CLASSPATH for stub deployment requires that all VMs that reference a stub instance obtained from that registry have the stub's class file installed locally (in the VM's CLASSPATH).

Frequently Asked Questions About RMI

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: stub not found
jQuery in Action, 3rd edition