wood burning stoves 2.0*
The moose likes Java in General and the fly likes java.rmi.UnmarshalException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java.rmi.UnmarshalException?" Watch "java.rmi.UnmarshalException?" New topic
Author

java.rmi.UnmarshalException?

carl varola
Ranch Hand

Joined: May 16, 2002
Posts: 59
All,
I'm trying to run a java RMI program,here is the error and below are all my file code,any help will be appreciated.
the exception is
================================
C:\java\rmi\projects\project2>java -Djava.security.policy=RMISecurity.poli
cy -cp c:\java\rmi\projects\project2 ServerProgram
java.rmi.ServerException: RemoteException occurred in server thread; nested
exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException: RemoteInterfaceImpl_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exceptio
n is:
java.lang.ClassNotFoundException: RemoteInterfaceImpl_Stub
java.lang.ClassNotFoundException: RemoteInterfaceImpl_Stub
================================
ServerProgram
==============================
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
public class ServerProgram
{
public static void main(String str[])
{
if(System.getSecurityManager() == null)
{
System.setSecurityManager(new RMISecurityManager());
}
try
{
RemoteInterfaceImpl r1 = new RemoteInterfaceImpl("Matt1",99,"Charlotte");
//RemoteInterfaceImpl r2 = new RemoteInterfaceImpl("Matt2",88,"Charlotte2");
//r1.setName("Matt1");
//r1.setAge(99);
//r1.setCity("Charlotte");
//r2.setName("Matt2");
//r2.setAge(188);
//r2.setCity("Charlotte2");
Naming.rebind("object1",r1);
//Naming.rebind("object2",r2);
System.out.println("Objects bound");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
===========================
RMISecurity.policy
======================
grant codeBase
"file:/c:/java/rmi/projects/project2/"{
permission java.net.SocketPermission
"127.0.0.1", "accept, connect, listen, resolve";


};
==============================
RemoteInterfaceImpl
==================================
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class RemoteInterfaceImpl extends UnicastRemoteObject implements RemoteInterface
{
private String name;
private int age;
private String city;
public RemoteInterfaceImpl(String name,int age,String city) throws RemoteException
{
this.name=name;
this.age=age;
this.city=city;
}
public String getName() throws RemoteException
{
return this.name;
}
public int getAge()throws RemoteException
{
return this.age;
}
public String getCity() throws RemoteException
{
return this.city;
}
public void setName(String name) throws RemoteException
{
}
public void setAge(int age)throws RemoteException
{
}
public void setCity(String city) throws RemoteException
{
}
}
Vikas Varma
Greenhorn

Joined: Aug 21, 2002
Posts: 23
From the Exceptions I see that the stub-skel class files are not being loaded, because it is not in the classpath.
Try running the server with the -classpath or -cp option, it should come up properly.
--Vikas
Vikas Varma
Greenhorn

Joined: Aug 21, 2002
Posts: 23
Again, I hope you created the stub-skeleton files using
rmic RemoteInterfaceImpl
Compile the generated files, and I think you'd be ready to go!
--Vikas
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I think this belongs in the "distributed Java" forum.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.rmi.UnmarshalException?