Problem sending linked lists
So here is my Doubly Linked List class.
import java.io.Serializable;
import java.rmi.*;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
@SuppressWarnings("serial")
class Linkk extends UnicastRemoteObject implements DLL,Serializable {
public String en;
public int pktno;
public String src;
public String dest;
public String data;
public int dist;
public Linkk next;
public Linkk previous;
public Linkk() throws RemoteException
{
}
public Linkk(String e,int no,String src,String dest,String data,int dist) throws RemoteException
{
this.en=e;
this.pktno=no;
this.src=src;
this.dest=dest;
this.data=data;
this.dist=dist;
}
public void displayforward() throws RemoteException {
// TODO Auto-generated method stub
}
public void insertlast(String e, int no, String src, String dest,
String data, int dist) throws RemoteException {
// TODO Auto-generated method stub
}
public boolean isEmpty() throws RemoteException {
return false;
// TODO Auto-generated method stub
}
}
@SuppressWarnings("serial")
public class DoublyLinkedList extends Linkk implements DLL,Serializable {
private Linkk first;
private Linkk last;
public DoublyLinkedList() throws RemoteException
{
first=null;
last=null;
}
public boolean isEmpty() throws RemoteException
{
try {
if(first == null)
{
return true;
}
}
catch(Exception e)
{
e.printStackTrace();
}
return false;
}
public void insertlast(String e,int no,String src,String dest,String data,int dist) throws RemoteException
{
try
{
Linkk newlink = new Linkk(e,no,src,dest,data,dist);
if(isEmpty())
first=newlink;
else
{
last.next=newlink;
newlink.previous=last;
}
last=newlink;
}
catch(Exception e1)
{
e1.printStackTrace();
}
}
public void displayforward() throws RemoteException
{
try
{
System.out.println("The list is as follows\n");
Linkk current = first;
while(current!=null)
{
String disp="\n"+current.en+" Packet#"+current.pktno+" SA:"+current.src+" DA:"+current.dest+" Data:"+current.data+" Dist"+current.dist+"\n";
System.out.println(disp);
current=current.next;
}
System.out.println("\n");
}
catch(Exception e2)
{
e2.printStackTrace();
}
}
}
The following is my DLL interface
import java.rmi.server.*;
import java.rmi.*;
public interface DLL extends Remote {
public boolean isEmpty() throws RemoteException;
public void insertlast(String e,int no,String src,String dest,String data,int dist) throws RemoteException;
public void displayforward() throws RemoteException;
// public void displayLink();
}
When i try to send an object.. I do the following...
DLL node = (DLL)Naming.lookup("//localhost/Server");
node.insertlast(sym, inc, source, destt, data, 1);
oos.writeObject(node);
I get the following error..
java.lang.ClassCastException: TPNImpl_Stub
TPNImpl is another class implenting a different interface...
Please please tell me where i am going wroing!!! Please!!!