Gotchas
As you start to implement your own Session beans, there's bound to be a couple of aspects that will trip you up. The following quick checklist of such “gotchas” should keep you on the straight-and-narrow:
When you look up resources from JNDI, you should use a string of the form java:comp/env/XXX. However, in the deployment descriptor, only the XXX is needed; the java:comp/env prefix is implicit.
Perhaps obvious, but don't use ejb as a prefix for naming your business methods. Names of that format are reserved for the EJB architecture callback methods.
Don't implement the remote interface in your bean! If you do so, your bean could inadvertently return itself (Java keyword this) as a return type. If a client starts invoking methods on this ...
Get Sams Teach Yourself J2EE™ in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.