posted 18 years ago
The following code is considered to be incorrect:
Context initCtx = new InitialContext();
TaxHome taxHome = (TaxHome) PortableRemoteObject.narrow(initCtx.lookup("java:comp/env/ejb/tax"), TaxHome.class);
Tax tax = (Tax) PortableRemoteObject.narrow(taxHome.create(), Tax.class);
The explanation: "Casting using PortableRemoteObject is not done for remote interfaces returned by bean methods".
I agree the component interface doesn't need to be narrowed, nor even casting is required. But I think the code is correct and runs without any problems.
Miki
Miki<br /> <br />SCJP 1.4, SCBCD 1.3