I think this is almost right...
One thing I'd specify is that if the
servlet client is a part of the same
J2EE App Server, than the servlet and the bean clients will be identical, and what you refer to as SimpleClient (like our standalone plain old
Java app) should really be called "A non-J2EE client", which could mean a standalone Swing GUI, or a servlet.
So, the two issues that you've specified are correct;
1) How do you get the InitialContext?
2) What do you code in the lookup
String?
So, here we go:
1) InitialContext:
For J2EE clients (which could mean another bean, a servlet running in the servlet Container of the same J2EE server, or even a "J2EE application client", you can ask for the default InitialContext. The Contianer *knows* it's own JNDI context.
But for NON-J2EE clients, of course, you must specify *somehow* the location and class type of the driver for that server. You can do this in several ways: invoking InitialContext() overridden constructor that takes a Properties object; invoking the no-arg constructor and assuming that it will find the jndi.properties file that has the correct info, or specifying command-line arguments that set those properties. This is really dependent on your app server.
2) For the lookup String, NON-J2EE clients must specify the JNDI name configured on deployment of the app. J2EE clients will use the java:com/env lookup, because that allows them to use a coded name that can (in the DD) be mapped to something else later.
Does that help? We should make a table like you've done and put it on our web page... or add to the next edition of the book. It's a great idea!
cheers,
Kathy