• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

java.rmi.UnmarshalException?

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
{
}
}
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this belongs in the "distributed Java" forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic