From R.M. Haefel's book on EJB I understand, that EJB clients that are EJB's themselfes, use a somewhat different (namingcontext-)lookup method than 'regular' clients.
But why ?
Why the <ejb-ref> tag in the deployment descriptor and why the 'java:comp/env' namespace ?
When the client is in the same JVM you can use the
no-argument call to get the InitialContext. Otherwise,
you need to specify the context factory and URL.
InitialContext ic = new InitialContext();
This is not correct. See my answer in this thread.
I think the main idea behind ejb-ref was to allow beans in the same jar to be able to do a lookup without having to go to the naming service, and to optimize colocated calls. It's also useful because that way, the EJB provider can notify the application assembler or deployer that the bean needs the presence of another bean to work correctly.