Hi,
I try to develop a client sample to call my EJB (CMP) as follows:
public class Client_1 {
public static void main(String [] args){
try {
Context jndiContext = getInitialContext();
System.out.println("step 1");
Object obj = jndiContext.lookup("CabinBean");
System.out.println("step 2");
CabinHome home = (CabinHome) javax.rmi.PortableRemoteObject.narrow(obj,
CabinHome.class);
System.out.println("step 3");
Cabin cabin_1 = home.create(1);
System.out.println("step 4");
System.out.println("created it!");
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShip(1);
cabin_1.setBedCount(3);
CabinPK pk = new CabinPK();
pk.id = 1;
System.out.println("keyed it! ="+ pk);
Cabin cabin_2 = home.findByPrimaryKey(pk);
System.out.println("found by key! ="+ cabin_2);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShip());
System.out.println(cabin_2.getBedCount());
} catch (java.rmi.RemoteException re){re.printStackTrace();}
catch (javax.naming.NamingException ne){ne.printStackTrace();}
catch (javax.ejb.CreateException ce){ce.printStackTrace();}
catch (javax.ejb.FinderException fe){fe.printStackTrace();}
}
public static Context getInitialContext()
throws javax.naming.NamingException {
Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "allaire.ejipt.ContextFactory");
p.setProperty(Context.PROVIDER_URL, "ejipt://170.207.80.44:2323");
return new InitialContext(p);
}
}
When I run it, I got the following exception:
step 1
step 2
step 3
step 4
created it!
keyed it! =1
java.rmi.RemoteException: System exception/error caught by container; nested
exception is:
java.lang.NullPointerException
java.lang.NullPointerException
Seem to me the record has been created, but the client failed in reading it back. If
it is stored somewhere where
is it being stored?
Any idea is appreciated.
Andi
===========================================================================
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".