Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to find Skeleton in the rmi invokation  RSS feed

 
Jayasri Alaparthi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I used one interface and implementation class to invoke RMI they are as follows

package com.rmi;
import java.rmi.Remote;
public interface CountRMI extends Remote {

public int sum() throws java.rmi.RemoteException;
public void sum(int _val) throws java.rmi.RemoteException;
public int increment() throws java.rmi.RemoteException;
}

package com.rmi;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.*;


public class CountRMImpl extends UnicastRemoteObject implements CountRMI {
private int sum;

public CountRMImpl(String name) throws RemoteException{
super();
try{
Naming.rebind(name, this);
sum=0;
}
catch(Exception e){
System.out.println("Exception:" + e.getMessage());
e.printStackTrace();
}
}

public int sum() throws RemoteException{
return sum;
}
public void sum(int _val) throws RemoteException{
sum = _val;
}
public int increment() throws RemoteException{
return ++sum;
}


Implementation class, when I compile both and run rmic CountRMImpl I got the following error,

public class CountRMImpl extends UnicastRemoteObject implements CountRMI
^
Error is stated at CountRMI
please help me to over come this.

Thanks,
Bhargavi.
 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is with the packaging. If you type 'rmic <CLASSNAME>', it will not work because this class is packaged. Instead, go to the base directory of package (where your 'com' directory is), then type 'rmic com.rmi.CountRMImpl'. It will execute the rmi compiler.

Also, there are no "skeletons" in the new RMI, only "stubs". Even though many books use the concept of stub & skeleton for descriptions, in the when you execute rmic, it will only create a stub, which is named as "<classname>_Stub.class".

Hope this will solve your problem.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!