Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default 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!!!

  2. #2
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

Similar Threads

  1. Sending linked lists via sockets
    By deepthought015 in forum Networking
    Replies: 1
    Last Post: 04-26-2009, 03:33 AM
  2. Doubly Linked Lists
    By stevenson15 in forum New To Java
    Replies: 6
    Last Post: 04-21-2009, 01:35 PM
  3. Facing problem while sending e-mail
    By jay8186 in forum Java Servlet
    Replies: 1
    Last Post: 03-25-2009, 08:34 AM
  4. question about linked lists
    By jkurth in forum Advanced Java
    Replies: 1
    Last Post: 11-11-2007, 09:33 AM
  5. Problem when sending application server with RAD 6
    By Marcus in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 07:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •