Hi, i'm going crazy over this - help me.


Here's a Stateful Session Bean - am I right?

Remote: Database

public interface Database extends EJBObject
{
   public Database1 getDBase () throws RemoteException;

}



EJB: DatabaseEJB

public class DatabaseEJB implements SessionBean
{

   public Database1 dBase = new Database1 ();

   public void ejbCreate () throws CreateException
   {
   }

   public Database1 getDBase ()
   {  return dBase;
   }


   public DatabaseEJB ()
   {
   }

   public void ejbRemove ()
   {
   }

   public void ejbPassivate ()
   {
   }

   public void ejbActivate ()
   {
   }

   public void setSessionContext (SessionContext sc)
   {
   }
}


Home: DatabaseHome

public interface DatabaseHome extends EJBHome
{  Database create () throws RemoteException, CreateException;
}


and, Database1 is another ordinary java class extending Object (non-ejb).

I deploy the application containing this bean (Stateful Session bean) and
add as a library jar the jar containing Database1. Deployment into the j2ee
app server using the j2ee deploytool - successful. I also receive the return
client jar with all the necessary classes and stubs in them.

I have a test client with the ffg code in it:

try {
        Context c = new InitialContext ();
        Object o = c.lookup ("Database");
        DatabaseHome dHome = (DatabaseHome)PortableRemoteObject.narrow (o,
DatabaseHome.class);

        Database d = dHome.create ();

        Database1 ds = d.getDBase();   //**** This line causes the exception
****


      }
      catch (Exception ex)
      {  System.err.println("Caught an unexpected exception!");
         ex.printStackTrace();
      }

The test client runs but throws the java.lang.ClassCastException. I dont
know why the Database1 object cannot be returned.
Can someone please help me here?

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to