1 Reply Latest reply on Dec 20, 2004 7:32 AM by darranl

    ClassCastException

    naveen

      I have written a simple CMP Entity Bean,While Running the Client I am getting the Exception,I have included all jars needed.


      i am in start
      err in StudentHomejava.lang.ClassCastException
      i am in end


      my client code is


      import javax.ejb.*;
      import javax.naming.*;
      import java.rmi.*;
      import javax.rmi.*;
      import java.util.*;

      import student.student1.*;

      public class StudentClient
      {
      public static void main(String args[])
      {
      System.out.println("i am in start");
      StudentHome home= null;
      try{
      System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url", "localhost:1099");
      Context context = new InitialContext();
      try{
      home = (StudentHome)PortableRemoteObject.narrow(context.lookup("Student"), StudentHome.class);
      }catch(Exception e){System.out.println("err in StudentHome"+e);}
      /* try{
      home.create("Ammamn","A01");
      }catch(Exception e){System.out.println("err in HomeCreate"+e);}*/
      }catch(Exception e){System.out.println("error in client"+e);}

      System.out.println("i am in end");
      }

      }


      The error is the place where i am casting.(different font)

      can anybody clear it.

      thanx

      NaveenBabu.A

        • 1. Re: ClassCastException
          darranl

          What is the full exception produced by a e.printStackTrace() ?

          Are you sure that your client has the same version of the interface as the server?

          Are you sure that your bean is configured to use the correct home interface?